aspose file tools*
The moose likes Beginning Java and the fly likes To set CLASSPATH in Win 98 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "To set CLASSPATH in Win 98" Watch "To set CLASSPATH in Win 98" New topic
Author

To set CLASSPATH in Win 98

Kavitha Pari
Greenhorn

Joined: Sep 15, 2003
Posts: 4
hai all,
i am trying to execute Java in Windows 98.
I tried setting the CLASSPATH using the cmd,
set CLASSPATH = classpath1;%CLASSPATH%
It worked, and i am able to use 'javac'. But, once i close the dos prompt, the changes made to the CLASSPATH is not effective. Once again i have to make the changes.
i want all changes made to be effective, every time i boot the system.
And also, i am not able to open the autoexec.bat file in the root directory(C) using the notepad.
Please help me.
Thanks.
deep venu
Ranch Hand

Joined: Jun 09, 2001
Posts: 56
hmm.. not that I have tried on Win98 machine but you should be able to set the classpath once and forall by setting the classpath under "envirnoment variables" which you would by right clicking on my computer.--> properties-->advanced.
Once you do that you should be able to run javac on any of dos prompts
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
Hi Kavitha
Follow the steps in order :
1. Find out where java is installed. (directory would be somewhat like j2sdk1.4.0 for Java SDK 1.4)
2. Goto autoexec.bat, open it and add an entry like



This is in case you have Windows 95, 98. In case of Windows 2000/XP different steps need to be followed.
3. Before you compile/run any program restart the machine.
4. Make a file like say chapter1.java and save it in the folder "C:\J2SDK1.4.0\BIN\".
5. Compile and run the file. The file should now run.
To edit the autoexec.bat, select autoexec.bat and right-click then choose edit from the menu or from the DOS prompt type

Now in the window that now opens add the entry specified above, after all the previous line/s(if any).
I would suggest that you keep an entry in the autoexec.bat as well. To be sure copy the file with a different name like ae.bat or anything. Then in case you mess up with editing or anything you can again copy back/rename the ae.bat to autoexec.bat.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

SET CLASSPATH=C:\J2SDK1.4.0\BIN;

Why are setting CLASSPATH to bin directory.


Groovy
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
You can use any path you like instead of the bin directory.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Kavitha Pari,
Welcome to JavaRanch!
Just in case you weren't able to extract the good advice from the responses so far, take a look at the advice offered on our wiki at http://test.javaranch.com/wiki/view?HowToSetTheClasspath
and on Sun's Java Tutorial on Brewing Your First Cup of Java.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Kavitha Pari
Greenhorn

Joined: Sep 15, 2003
Posts: 4
Hai all,
Thanks for your help.
In Windows 98, we dont have the option to set the "Environment variables" in "My Computer --> properties".
So i entered the following in autoexec.bat
set PATH=C:\j2sdk1.4.1_05\bin;%PATH%
and just executed the following cmd.
C:\> autoexec
But, once i close the dos prompt, all the changes made are not effective.
So when i open the dos prompt, once again i have to just execute the above cmd. There is no need to do the changes in autoexec.bat file.
Your suggestions were really helpful.
Thanks.
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
The advantage of putting the CLASSPATH changes in the "autoexec.bat" file is that when you re-boot the machine the environment is set based on those commands. So if you change the "autoexec.bat" file nothing happens until you re-boot. After you re-boot you'll never have to set the CLASSPATH again. Unless you need to change it later on. So there is a very real benefit by putting your changes in there.
Jithesh Kozhipurath
Ranch Hand

Joined: Aug 27, 2003
Posts: 76
Hai,
When i installed java on my machine i used sysedit command to set the classpath. Its same as the autoexec.bat


Jithesh K
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To set CLASSPATH in Win 98