sara
sara

Reputation: 11

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 i 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?

Upvotes: 1

Views: 86

Answers (4)

technomage
technomage

Reputation: 525

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.

Upvotes: 1

user467871
user467871

Reputation:

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.

Upvotes: 0

craftsman
craftsman

Reputation: 15653

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.

Upvotes: 0

Noon Silk
Noon Silk

Reputation: 55182

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

Upvotes: 4

Related Questions