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 syst开发者_Python百科em?
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
精彩评论