Java can be configured both temporary and permanently. Note that the temporary configuration will only limit to the dos windows we used to configure.
So first of all let's see how to configure temporary.
STEP 1: Open dos prompt (Click on Start then Run, type "cmd" and press Enter).
STEP 2: Issue the following command and press Enter.
set path=c:\j2sdk1.4.0\bin;
That's all you have to do and now you can use any java tool from anywhere in the dos prompt.
Next we'll see how to configure java permanently.
STEP 1: Select AUTOEXEC.bat file, right click the mouse button and click on edit.
(AUTOEXEC.bat file is in "C:\" and it's hidden by default. So to see it you have to select "Show hidden files and folders" and disable "Hide protected operating system files (Recommended)". Click on OK. This will ask for confimation and click on Yes.
STEP 2: Enter the following two lines and save the file
set path=c:\j2sdk1.4.0\bin;
set classpath=c:\j2sdk1.4.0\lib\classes.zip;
STEP 3: Select My Computer, right click the mouse button and click on properties. Click on the Advanced tab. Click on "Environment Variables".
STEP 4: Click on "New" in the "System variables" section on "Environment Variables" dialog box.
STEP 5: Enter Variable name and variable value as follows on the "New System Variable" dialog box.
Variable name: set path
Variable value: c:\j2sdk1.4.0\bin;
Click on OK.
STEP 6: Repeat STEP 4 and enter varible name and variable value as follows on the "New System Variable" dialog box.
Variable name: set classpath
Variable value: c:\j2sdk1.4.0\lib\classes.zip;
Click on OK.
STEP 7: Click on OK and again on OK.
STEP 8: Restart the computer.
Now you have configured java permanantly.
Special thanks to Mr.Kooragoda @ IDM Galle branch
First of all when configuring for the current session a better method to use is path = %path%;"{path_to_bin_directory}; (No need of the set word since path is already defined. Check it before doing this) This will preserver the current path
ReplyDeleteSecond when adding the path permanently
The method discribed using a autoexc.bat is when using windos 9x. The way to set it in Windos XP is to add it in to environment variables. The variable is path not set path.
And finallly there is no need to set a explicit classpath for the standard library classes in newer versions of Java. Including 1.4. (But early ones it should be)
I think you are right Uthpala
ReplyDeletei was bit confuse regarding OS as i am using Windows XP and Mr. Kalpa didn't mension about Operating system because when we configure for Window 9X varible name "set path" is used... and not for Xp..
thanks for your info..
ReplyDeletei managed to set up the environment after searching here and there..
i have done it before but u know sometimes we forget..but after refer here i managed to do it..thanks for your info...
@User
ReplyDeleteYour welcome
Yeah, most of the time we do it once and after we keep on coding. So that the chance to practice is less :-)
A SUPPORTED BY THE DEVELOPER TOOLS? It was interesting. You seem very knowledgeable in ypour field.
ReplyDelete