Understanding the use of the command line utilities for Java is a needed skill at this point in the game since you might not have a GUI all the time.
So in order to compile and run Java files you simply do the following:
- Open the Windows Start Menu
- Go to the search bar and type "cmd" into it.
- Click the program that comes up. You will get greeted with a Classic Command Line Interface or "CLI"
- Now to navigate the file system you simply use the "cd" command which means "Change Directory"
- So to get to your Java files you simply use: cd c:\\path\to\java_files (cd C:\Program Files\Java\jdk1.7.0_17 - to get the JDK folder)
- To compile a program navigate to where you keep your java programs (cd C:\Users\Zilvarael\Desktop\Android Dev Tools\eclipse\CoffeeShop -- for me)
- then you simply use the: javac programName.java (Ex: javac hello.java) javac = Java compiler.
- To run the program you simply do the following: java hello to launch any java class file!
To launch a java applet:
- Use java compiler on what the applet file: javac applet.java
- Launch the applet by using: appletviewer applet.html -- This is after an applet is made in my case I learned from the books example applet (Which can be found in the CoreJava Source we downloaded before.
No comments:
Post a Comment