• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ObjectInputStream cause of program freeze? Or Java update?

 
Greenhorn
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am not sure where to start debugging to deal with a freezing program. This is strange since the program runs fine from within the Eclipse IDE. When I export it to a runnable JAR, the freeze happens after a few interactions with that instance of the program.

I'm on OSX 10.7.4 and my JAR freezes in both 1.6_37 and 1.7_09. One unknown from my POV is how Eclipse runs with multiple versions of Java installed on my Mac. When I set Eclipse to compile with either 1.6 or 1.7, the program runs fine in the IDE. Using the Java Preferences utility program, I have moved both 1.7 and 1.6 64bit into the top spot during my quest to find the cause of this problem. Whenever I run Terminal and type java -version, it always returns 1.7_09 so I don't know if Eclipse follows that or not when I set it to compile in 1.6.

The program stores text in an ObjectOutputStream that is stored locally in a file. I use ObjectInputStream to access the file. The file is less than 100k.

I am at a loss as to explain why it runs in the IDE, but fails as a JAR. When running with either the JAR version or inside the IDE, both access the same file with the Streams.

Perhaps someone can point me in the direction of a possible cause? Or maybe a guess? I know the scope of this question is awfully general, but until I can narrow down where to look, I don't know how to be more specific. I don't remember having this problem before the recent updates to Java, but I've only made this program a runnable JAR a few times in the past, so the problem may have existed before the updates.

Thanks for the help,

BD
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, my recommendation would be to stop looking for answers involving problems with other people's software, and focus your search on problems with your own software. At least, that's the technique I use (I call it the It's-Always-My-Fault technique) and it works quite well for me. I think the issue of the Java version is probably a red herring. Or maybe not, but you aren't going to know until you look at your own code to see how it reacts.

So, what I would suggest is to do some debugging to see what code is running when the "freeze" takes place. I could take a wild guess that your code is trying to treat a resource which you put into your JAR as a file, but that would only be a wild guess. You might have to modify your code to produce debugging output.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic