Reputation: 158
So I'm trying to add a jar file to the environment variables in windows so instead of running java c:\mega_long_file_path\filename.jar
I can run filename
I tried adding ;c:\mega_long_file_path\filename.jar;
to the PATH variable in Control Panel >System and Security > System > advance system settings > advance > environment variables
and that didn't work , I'm positive I have done this before what am I missing?
Upvotes: 4
Views: 6578
Reputation: 2480
Make a batch file named filename.bat
and put this line in it:
java -jar c:\mega_long_file_path\filename.jar
Then put this batch file into your PATH or update your PATH to point to the directory where you created it.
After that you should be able to run filename
.
Upvotes: 4
Reputation: 1
If I understand your question correctly I think what you want is to add it to CLASSPATH instead of PATH (Create the CLASSPATH environment variable if it is not already there)
Upvotes: 0