Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

Jar files

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic