File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EXE JAR shows FileNotFound Exception, runs fine on netbeans

 
rohan sethi
Ranch Hand
Posts: 34
Java Netbeans IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Creating a swing GUI application, and when run through an exe file, it throws FileNotFound Exception.
The path in my actual code is by using getClass().getResourceAsStream().I think here is some problem..
Runs fine on NetBeans, but fails to do so when converted to .exe file.
What should i do to overcome FileNotFound Exception?
 
Tony Docherty
Bartender
Pie
Posts: 2878
59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Creating a swing GUI application, and when run through an exe file, it throws FileNotFound Exception.

How are you converting the app to a .exe? or do you mean you are packaging it in a jar file?

The path in my actual code is by using getClass().getResourceAsStream().

The file needs to be located on the classpath of the object's classloader. What file path are you passing into the method
 
rohan sethi
Ranch Hand
Posts: 34
Java Netbeans IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahh solved it.Just was a simple problem.Need to use a "\" in getResource() .To show it's not a directory.
 
Tony Docherty
Bartender
Pie
Posts: 2878
59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rohan sethi wrote:Need to use a "\" in getResource() .To show it's not a directory.

That doesn't mean the name is not a directory. If you don't start the name with a slash then the given path of the resource to load is relative to the package of the class.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic