将利用acm.jar制作的java做成applet


1. manually add acm.jar each time

You can add -classpath .:/usr/share/java/acm.jar to your command as in:

 javac -classpath .:/usr/share/java/acm.jar MyApplet.java

2. change your environment for the current session

You can add acm.jar to your classpath in your current bash shell (your terminal session) with the following command:

test -z $CLASSPATH && export CLASSPATH=.:/usr/share/java/acm.jar || export CLASSPATH=.:/usr/share/java/acm.jar:$CLASSPATH

If you enter (or cut and paste) the above command in your terminal it will create a classpath for you if you don’t have one, or it will add acm.jar to your existing classpath if you already have one.

3. Change your environment for all sessions

If you are going to be using acm.jar regularly, the easiest thing to do in the long run is to set your classpath in your .bashrc file. 1) If you do this then once the change is in place any time you open a terminal your classpath will be set for you.

To make this modification, edit the file ~/.bashrc and add the following lines to it at the end:

#
# Added to include current directory and acm.jar to the CLASSPATH
#
 if [ -z "$CLASSPATH" ]; then
      export CLASSPATH=.:/usr/share/java/acm.jar
 else
      export CLASSPATH=$CLASSPATH.:/usr/share/java/acm.jar:$CLASSPATH
 fi

The lines above do the exact same thing as the test -z line in the previous section does, but they do it less opaquely and so are a better choice for your .bashrc file. Once you add these lines and save your .bashrc file, and time2) you open a terminal your classpath will be set for you.



Here are Linux/Mac command line instructions for preparing your JTF programs to run as an applet:

  • Compile your program with acm .jar on the class path:

javac -classpath acm.jar MyApplet.java (this creates the file MyApplet.class)

  • Create a copy of the acm .jar file:

cp acm.jar MyApplet.jar

  • Add your compiled class file(s) to your new jar file:

jar uf MyApplet.jar MyApplet.class

  • Create an  HTML file containing the applet tag for your program. For example, here is MyApplet.html:
<html>
  <applet archive=MyApplet.jar
          code=MyApplet.class
          width=500 height=300>
  </applet>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值