• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

To set CLASSPATH in Win 98

 
Kavitha Pari
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SET CLASSPATH=C:\J2SDK1.4.0\BIN;

Why are setting CLASSPATH to bin directory.
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use any path you like instead of the bin directory.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kavitha Pari
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
When i installed java on my machine i used sysedit command to set the classpath. Its same as the autoexec.bat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic