Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Jar files

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
    Bookmark Topic Watch Topic
  • New Topic