This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes errors when using bat file to launch .jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "errors when using bat file to launch .jar" Watch "errors when using bat file to launch .jar" New topic
Author

errors when using bat file to launch .jar

Jeremy James Brown
Greenhorn

Joined: Mar 24, 2011
Posts: 27
I am facing a strange issue. My code runs just fine from Netbeans or cmd with



but when I try to run it from the .bat



I get just error in my text file



or a null pointer exception at the line I have new FileReader(nrmavg.txt)

I can provide more code if needed, but I think this may be a windows problem.
Any ideas?
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3605
    
  14

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.
 
wood burning stoves
 
subject: errors when using bat file to launch .jar
 
Similar Threads
Not able to call a bat file from JAVA
how to run a .bat file from java program.
Java Web Start
run bat file within java
How do I deploy my application using a jar?