• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jar files  RSS feed

 
Lynn Forrester
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created an executable jar file contianing all my code, however the problem is that when this jar is run the user can select any text file they wish to open and the program should open this and display the information. But when the jar is run and a file is selected then nothing happens.
I read somewhere about using getResourceAsStream method and so far my code looks like this,
InputStream in = this.getClass().getResourceAsStream(filename)
//where file name is a string that came from JFileChooser
BufferedReader in2 =new BufferedReader(new InputStreamReader(in))
This code, however, always returns a nullpointerexception as though it cannot find any of the files that are being slected.
Any Ideas?
Thanks Lynn
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!