Click to See Complete Forum and Search --> : tired of typing entire path for java compile


sneakyimp
03-01-2006, 11:49 AM
ok...i've been doing the java writing tutorials on sun.com and most of them suggest you can compile a java project simply by typing:


C:\divelog>javac -classpath C:\ DiveLog.java


I find that I have to type in the ENTIRE path to javac.exe like this:

"C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" -classpath C:\ DiveLog.java


Is there something I can do to register the exe so I don't have to do that?

Also, what the heck does 'classpath' do?

TheBearMay
03-01-2006, 12:23 PM
For something like that I always wrote a quick .bat file and ran it by entering:

jc DivdeLog.java

Inside the jc.bat file:

"C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" -classpath C:\ %1

sneakyimp
03-01-2006, 12:37 PM
that sounds pretty easy. where do you keep your jc.bat?

TheBearMay
03-01-2006, 01:03 PM
Generally where ever my .java files are so that I don't have to give a full path to them.

sneakyimp
03-01-2006, 01:23 PM
THANKS. super helpful.

Khalid Ali
03-01-2006, 01:43 PM
I better solution is to set the classpath, path and home environment variables. That takes care of running any script before any compilation etc. for more info on this read the sticky at the top for troublshooting

Mr. Ram
03-06-2006, 02:50 AM
yes.

I have Added java bin path to path in environment variables.