Compiling Source Code

     

To compile Java programs after you have installed the SDK, open a console. In Windows, go to Start > Run and type cmd to get a command prompt.

Note that if you have multiple JDKs on your system, you may need to supply the “source 1.5 flag to the javac command to ensure that your code is compiled correctly.

 

 C:\garage\src>javac -source 1.5      net\javagarage\demo\MyProgram.java 

This compiles the Java source code into a class file in the same directory.

If all goes well during compilation, you get a new command prompt, and nothing else. You are now ready to run your program using the java command.



Java Garage
Java Garage
ISBN: 0321246233
EAN: 2147483647
Year: 2006
Pages: 228
Authors: Eben Hewitt

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