A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
errors when using bat file to launch .jar
Jeremy James Brown
Joined: Mar 24, 2011
Oct 15, 2011 20:23:11
I am facing a strange issue. My code runs just fine from Netbeans or cmd with
> java -jar MP2.jar
but when I try to run it from the .bat
"%JAVA_HOME%"\bin\java -jar .. \dist\MP2.jar > test_mp2_out.txt
I get just error in my text file
DataIn\nrmavg.txt (The System cannot find the path specified)
or a null pointer exception at the line I have new
I can provide more code if needed, but I think this may be a windows problem.
Stephan van Hulst
Joined: Sep 20, 2010
Oct 16, 2011 09:24:23
This is a guess, but the file you're trying to read is probably in some folder relative to your working directory, and the working directory is different when you run the code from your batch file.
I agree. Here's the link:
subject: errors when using bat file to launch .jar
How do I deploy my application using a jar?
run bat file within java
Not able to call a bat file from JAVA
Java Web Start
how to run a .bat file from java program.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015