Mailing Lists: Apple Mailing Lists

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

Re: Package information in manifest, without JAR?




On Nov 1, 2009, at 5:38 PM, Moises Lejter wrote:

"All" you would need to do is define your own ClassLoader, and have it look for this info however you want to capture it, before loading any classes.

I don't think you would exactly need to support your own ClassLoader that would need to look for the information.


You would need a java.util.jar.Manifest constructed with the InputStream, from whatever source, for your own jar-free manifest.

Manifest (Java 2 Platform SE v1.4.2)
http://java.sun.com/j2se/1.4.2/docs/api/java/util/jar/Manifest.html

For a ClassLoader you would need need a simple subclass based on the parent Constructor. So something like...
MyClassLoader mcl = new MyClassLoader(getClass().getClassLoader());


MyClassLoader would have to somehow make accessible the parent ClassLoader's protected access definePackage* method. (Just make it public?). So for that, something like...

public definePackage(...) { getParent().definePackage(...); }

You could then run the Manifest entries and add the package related information to the current ClassLoader via your MyClassLoader instance and you then have it available from every class already using that ClassLoader - and you're done**, you don't even need to keep the ClassLoader around.

*The ClassLoader definePackage method mentioned...
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ ClassLoader.html#definePackage(java.lang.String,%20java.lang.String,% 20java.lang.String,%20java.lang.String,%20java.lang.String,% 20java.lang.String,%20java.lang.String,%20java.net.URL)


**I haven't tried this, but it looks like it should work.

Mike Hall        hallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >Re: Package information in manifest, without JAR? (From: Greg Guerin <email@hidden>)
 >Re: Package information in manifest, without JAR? (From: Harald Kuhr <email@hidden>)
 >Re: Package information in manifest, without JAR? (From: Moises Lejter <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.