This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java 5->6 or Windows->Mac class loading differences?  RSS feed

 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Does anyone know of any differences in how class loading works, between Java 5 and Java 6? Or perhaps between Sun Windows Java 6 JVM and Mac Java 5 JVM?

I have an application with a custom class loader. It seems to be working fine on Windows and to be having problems on Mac OS X. I would expect them both to be the same.

It's possible that the difference is in fact one of timing, between my Mac and my PC, rather than platform, but I thought I'd ask the question.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not anything as trivial as path separator or directory name separator differences, is it? ':' and '/' on Mac OS X, and ';' and '\' on Windows?
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Er, no. This application has been working fine on Mac, Linux and Windows, for years, so those types of issues were sorted out ages ago.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like the problem may be due to the Mac "losing" the context class loader.

My app sets the main thread's context class loader, as the second statement in the whole app (constructing the loader is the first). All other threads ought to inherit that, as they're all descendents of main. But I find that there's sometimes a null context class loader, on the Mac.

That never happens on Windows.

Trying now to tie this down fully, so we double-check the bug's really Apple's. The alternative would be that it's in a third-party library (but then why only on Mac?).
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15860
80
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have a Mac, so I don't know of any differences in classloading. It is possible that it's a bug in either Sun's Java or Apple's Java for the Mac. You could try searching Sun's bug database, or Apple's (I don't know if they have a public bug database).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!