Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Classloaders and classes already loaded



Title: Message
Hi-
 
Our cross-platform application has a Mac specific code section to handle hiding the menu bar and dock (via NSMenu.setMenuBarVisible()) and hiding the cursor (via NSCursor.hide()).
 
Since I didn't want to have different launchers for our applications that only differed in the classpath (namely,  /System/Library/Java), we choose to create an URLClassLoader to use (with this classpath) when instantiating the above classes using Class.forName().
 
Since we are creating NSMenu and NSCursor classes in different parts of the code, we had to store a reference to the classloader, otherwise we ran into some errors when trying to create the second one.  (Sorry, I can't remember the exact error at this time).
 
Ok, we have just added the fast splash screen code the list talked about recently.  Of course, the 800X600 splash image running on the 800X600 monitor resolution is being cut-off by the dock on the Mac.  So, they naturally want to hide the menu bar and dock.  In order to avoid class loading slowdown, I copied the code from the section that normally did this dock hiding into my splash code.  It all works great...except when the main code goes and tries to load the NSCursor class.
 
I get an "UnsatisfiedLinkError: Native library already loaded in another classloader".  Sure, that makes sense.  Probably was the nature of the error before we stored a reference to the class loader back then.
 
Ok, since I want to keep the splash code separate from our application code, I'm stuck.  Here are the options I thought of:
 
1.) Just change the Mac launcher to include /System/Library/Java and don't use a "custom" class loader.
2.) Is there a way to unload the native library or class loader?
3.) Is there a way to ask if a class is loaded, and if so, then create an instance of it, even though I don't have the class loader?
 
Suggestions?  I realize #1 is probably easiest, but I found this as an opportunity to find out something new!
 
Thanks,
Mark
 
---
Mark Brown, Senior Software Engineer
Innovative Software Engineering
Technology Innovation Center
100 Oakdale Campus, #101 TIC
Iowa City, IA  52242
 
"The difference between ordinary and extraordinary is that little extra"
 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.