简体   繁体   中英

Running Java Applet Outside Eclipse

I have written a Java applet in Eclipse. How do I run it outside eclipse, or an another computer that doesn't have Eclipse? Will a runnable JAR File work on a non-local file system?

If you want a runnable jar with a main method, you use JFrame rather than an Applet

Also, find a more current tutorial. Think of awt as mostly deprecated (except for event handling and drawing). You should be using swing for UI.

If you want to put it in a browser, you use a JApplet (the swing equivalent of Applet).

If you want to run a jar file via command line, use java -jar myJarFile.jar

Often you can just double-click it.

Make sure you exported as runnable jar. If there's no main class specified in the manifest you can also do

java -cp myJarFile.jar main.MainClass

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