09-14-2011, 10:27 PM
I have java code in a file with .java extension. How do I run it?
How do you run a java applet?
|
09-14-2011, 10:27 PM
I have java code in a file with .java extension. How do I run it?
09-15-2011, 03:27 AM
The code needs to be compiled. You will need to install the JDK to do it. Once JDK is installed, under Mac OS X you can compile the code on the command line. Use terminal to navigate to the directory where the code is stored (if you don't know how, type cd and drag the folder where the code is stored onto your terminal window and press return). Now, type javac filename.java where filename is the name of your code. If no compiler errors are reported, then your code is compiled. Running the compiled program depends on the type of program it is. If it uses a command line interface, just type java filename where filename is the name of the compiled program. There should not be an extension. I hope this helps.
Now I just have to finish my Java project for class. |
« Next Oldest | Next Newest »
|