Sunday, October 26, 2008

Set up the Java Environment for the first time

Technically, this time is not the first time to set the Java environment for me. Long time ago I have ever done it on my note book with the direction from Samuel. Since I haven't touched Java for so long time, I nearly forgot all the necessary steps for the JDK environment setting. Now I need to re-install JDK6 on the sever. With the help of Google, I fininal settled it down. Here is the detailes step by step.(Suppose we've got the JDK installed successfully in this fold: c:\java)
1. Find this location: computer -> properties -> advanced settings -> environment variables (Notice that for the different platform, this setting may locate different.)
2. Create a new System variables named JAVA_HOME, and then value it as "c:\java\jdk1.6.0_10"(the place where the JDK is installed).
3. Add the following to the User variable PATH: "%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;"
4. Create a new System variable named CLASSPATH and value it as ".;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar";(Note the first dot and semicolon);
Okay, at the time the command window shows the help information when you run 'javac ' or 'java' without any params instead of the wrong message "javac: Command not found", you win.

/** -------------------------------- **/
The following I would say something about how to set Ultraedit for Java.
1. Run UltraEdit, then go to "Advanced" in the menu, and then "Tool configuration"

2. Create a shortcut for "javac"
Command: Menu Item Name -> javac; Command Line-> C:\jdk1.6.0_10\bin\javac "%f" ; Working directory -> %p;
Options: Program Type : Dos program; Save all files first;
Output: Output to the List Box; Capture Output;

3. Create a shortcut for "java -no params"
Command: Menu Item Name -> java -no params; Command Line-> C:\jdk1.6.0_10\bin\java "%n" ; Working directory -> %p;
Options: Program Type : Dos program; Save all files first;
Output: Output to the List Box; Capture Output;

4.3. Create a shortcut for "java -params"
Command: Menu Item Name -> java -params; Command Line-> C:\jdk1.6.0_10\bin\java "%n%modified%"; Working directory -> %p;
Options: Program Type : Dos program; Save all files first;
Output: Output to the List Box; Capture Output;

Okay, it is finished. It seems to be good. Let's try it.

3 comments:

Anonymous said...

Learn ant. After finished learning ant, you'll never need ultraedit to run java command.

Tingting said...

ant? What's that?

Anonymous said...

http://ant.apache.org/