Java Environment Set Up Guide
Integrated Development Environments (IDEs) for Java
IDEs are not required to develop Java programs, but it is extremely helpful to use them.
Once you have installed the either one of the above, you are good to write, compile and run Java programs. If you want to learn more about how Java technology works, you can keep reading the following which will show you how to set up Java environment for writing, compiling and running Java programs without an IDE.
Before You Start
JDK Path Set Up for Windows
Windows 7: Start Menu -> System Properties -> Advanced System Settings -> Advanced tab
Windows Vista: Right click My Computer -> Properties -> Advanced system Settings -> Advanced tab
Windows xp: Start Menu -> Control Panel -> System -> Advanced tab
Then:
Environment Variables -> System Variables -> PATH -> click on it.
In the Edit windows, append the jdk path to the existing PATH.
For example,
if your jdk path is c:\Program Files\java\jdk
add ;c:\Program Files\java\jdk to the end of your existing PATH variable, the semi-colon in front of your jdk path says you are appending the jdk path to the existing PATH.
JDK Path Set Up for Mac
Type
java -version
You should see information regarding the version of the java you have installed on your system.
If you don’t have the jdk installed by default, download the jdk from Apple and install it.
JDK Path Set Up for Linux
To check if Java is in your path, type the following in the Terminal Window:
java -version
If you see information regarding the version of the java you have installed on your system, that means you have the java in your environment path.
If you see COMMAND NOT FOUND, then do the following.
Assume you have the java jdk installed at /usr/local/jdk1.6/bin
Edit the startup file (.bashrc for bash shell) at your home directory, you can use the emacs editor
emacs .bashrc
Add the following two lines to the file
PATH="$PATH":/usr/local/jdk1.6.0/bin export PATH
Save and close the file, Ctr-x, Ctr-z
Restart the Terminal Window
Verify the PATH by type the following command
java -version
Compile and Run Java Programs
To Compile, type the following and enter:
javac Hello.java
Once you have compiled the java file, type the following and enter to run the program:
java Hello
Search within Codexpedia
Search the entire web