• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting up java environment

 
kamilla miesak
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm new to Java, and I've been trying to set up java SDK on my computer, so I can run programs from the command line. I've edited the execution path, and yet whenever I invoke java interpreter and compile a program - I'm getting a 'bad command' error. If I type 'java -version' - I do get all info about the java SDK, also typing 'javac' by itself gives me a list of options that come with the command. But when I type 'javac programName' the command is not recognized. How can I fix it?Thanks.
 
Val Dra
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is how i did it.
i went to run typed in sysedit and found autoexec.bat
then i added this lines to it
set PATH = %PATH%;c:\jdk1.3\bin
my class pathlook like this your can be something else
set CLASSPATH = .;c:\jdk1.3\bin\;C:\jdk1.3\lib\servlet.jar;c:\myClass;%TOMCAT_HOME%\lib\servlet.jar
you will have to reboot your machine after.
 
kamilla miesak
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried it again, but it seems that for whatever the reason the autoexec.bat file does not keep new path settings eventhough I do save them. After rebooting, and typing 'path' at the c:\ I still see only old paths, with no java\bin directory. I also do not have classpath in autoexec.bat - should I add it? What it should be pointing to? I don't have servlet.jar command under bin folder. I've tried adding it up pointing to java\bin directory only, but that didn't work either.
Again, I'd appreciate all help. Thanks.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At work I have an environment where they won't allow me to mess with my autoexec.bat. So I have a p.bat file that I created to modify the path and add a classpath. When I escape to DOS I just type p and all is good for that session. For convenience I also use that file to move me (\cd) into the java directory where I work.
You can create a bat file by going to the DOS prompt and typing edit p.bat and you get a REALLY rough editor, but it works. Just add the statements like Val described.
 
Siva Prasad
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Kamillia
You have to keep onething in your mind whenever you try to add or modify anything in autoexec.bat
i.e. it doesnot take the changes you made when you try to save that file. (Its a security issue in windows)
All what you have to do is..
rename the existing autoexec.bat and rename it as auto.tmp
and now edit this tmp file and add or modify PATH and CLASSPATH.
now rename this autoexec.tmp as autoexec.bat.
Reboot your PC and this time it would work.
If you still have problems then let us know.
onemore thing...
when u compile a java program do u use the fullname of the file?
e.g. javac sample.java or not?
if u say javac sample compiler gives an error.
Cheers
Prasad

[This message has been edited by Siva Prasad (edited March 07, 2001).]
 
kamilla miesak
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys, renaming the file finally worked! Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic