简体   繁体   中英

java- How to build the executable for the applet application

I implemented the java applet application. I searching for the process of how to create the executable file for this application.I am not find any good solution. Please can anybody help me.

thanks

The executable of a Java applet is either a .jar file, or the .class directory.

You execute a Java applet within a web page. You place the .jar file or the .class directory in your web directory structure.

Here's an example HTML applet:

<applet code=NameOfApplet.class name=NameOfApplet archive=NameOfApplet.jar
    width=300 height=300>
    <param name="bgcolor" value="ffffff">
    <param name="fontcolor" value="000000">
    Your browser is not Java enabled.
</applet>

Further information can be found at How to Make Applets .

It's been a while since I've had to code an applet, but the archive parameter can include directories.

  • Instead of creating an Applet or JApplet , create a JFrame .
  • Jar the classes.
  • Add a manifest file that specifies the main-class
  • Double click the Jar to launch.

If you would like to make it a nicer experience for the end user, create a web page that uses deployJava.js to check that a suitable JRE is installed, then launch the JFrame using Java Web Start .

Executable applet is nothing but the .class file of the applet, which is obtained by compiling the source code of the applet. Compiling an applet is exactly the same as compiling an application. Therefore, we can use the Java compiler to compile the applet.

Assume that we have created a file called HelloJava.java for our applet. Here are the steps required for compiling the HelloJava applet.

  1. Move to the directory containing the source code and type the following command: javac HelloJava.java

  2. The compiled output file called HelloJava.class is placed in the same directory as the source.

  3. If any error message is received, then we must check for errors, correct them and compile the applet again.

否则,如果要在浏览器外部运行applet,则可以正常创建JAR文件,然后使用appletviewer来启动它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM