Running a Java Program


javac HelloWorld.java  // compile source file java HelloWorld  // execute byte code



In this phrase, we first use the javac compiler to compile our Java source into a HelloWorld.class file. Then, we can execute the HelloWorld program using the java command and passing the name of the compiled class, HelloWorld. Note that you do not include the .class extension when passing the name to the java command.

The java executable is included with either the Java JDK distribution or the Java JRE distribution. This program is used to execute your compiled Java class files. The Java executable can be thought of as the interpreter that compiles your bytecode real-time into executable native code that runs on the platform you are executing on. The Java executable is a platform dependent piece of Java. Each platform that supports Java will have its own Java executable compiled specifically for that platform. This piece of Java is also called the virtual machine.




JavaT Phrasebook. Essential Code and Commands
Java Phrasebook
ISBN: 0672329077
EAN: 2147483647
Year: 2004
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net