开发者

Running Java Applet Outside Eclipse

开发者 https://www.devze.com 2023-01-29 13:26 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消