开发者

Question about java executeables?

If i have a very simple program say consisting of only a single .class file, how can i run it on some other computer. I mean 开发者_如何学Goi can run it using java filename, but point is i have jdk installed.

So how about someone, who does not have jdk and want to test out my class file. Is there any other way to do it for it to run without jdk. If it is not possible, then i don't find any benefit of using java, or is there any?


You don't need the JDK to run Java, you simply need the JRE, which almost all computers have.


You can wrap your java program in a launcher, such as http://launch4j.sourceforge.net/

if JRE not detected in the system, the launcher will ask user to download the JRE, or you can also provide bundled JRE in the package of program you distribute.

If it is really simple program, try compiling it using GCJ into native executable format. For windows, you can use MinGW gcj http://www.mingw.org/wiki/Compile_with_gcj

Executable from GCJ doesn't need JRE or JDK to launch, but might need some library (.dll or .so) to be distribute together with your executable.


Assume that your class name is HelloWorld. Open command prompt, navigate to the directory in which your HelloWorld.class is placed, type "java HelloWorld" and hit enter. Check out this link as well for a step-by-step tutorial.


You don't need JDK to test your Java .class JRE is enough

http://www.jguru.com/faq/view.jsp?EID=46223

The "JDK" is the Java Development Kit. I.e., the JDK is bundle of software that you can use to develop Java based software. The "JRE" is the Java Runtime Environment. I.e., the JRE is an implementation of the Java Virtual Machine which actually executes Java programs.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜