naresh
naresh

Reputation: 10402

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

Upvotes: 0

Views: 8413

Answers (4)

anush
anush

Reputation: 1

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.

Upvotes: 0

stivlo
stivlo

Reputation: 85516

Otherwise, if you want to run the applet outside the browser, you can create the JAR file normally and then user appletviewer to launch it.

Upvotes: 0

Andrew Thompson
Andrew Thompson

Reputation: 168835

  • 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.

Upvotes: 1

Gilbert Le Blanc
Gilbert Le Blanc

Reputation: 51553

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.

Upvotes: 3

Related Questions