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: Class Loader Oddity???



bsd5tu1 wrote:

>Those are NOT the exact command lines. The example above is just an
>example and not cut-n-paste.

All we can analyze or comment on is the examples you provide.  If you don't
provide the exact command-lines that work or fail, or the examples you
provide bear little resemblance to what you're actually using, then it
should be obvious that any analysis or comments will have little bearing on
what you're actually doing.


>That's a typo on my part. I'm used to OS X and Linux.

So am I, so I'll grant you the ":" typo.

However it still doesn't explain why you didn't give a Windows example of:
     java -jar C:\Users\test\runner\launcher.jar
which more accurately mirrors what you now say you actually use on Linux
and Mac OS X.

Or are you implying that you DID try something like that and it didn't work
either?  And that the only thing that worked was:
  java -classpath .;C:\Users\test\runner\abc.jar -jar launcher.jar

Note that I've used ";", correcting the typo.  I assume, however, that the
rest of the pathname is correct.

This command-line is still puzzling, however, because the -classpath arg
should be ignored.  If it's NOT being ignored, you have to discover and
demonstrate that by dumping the "java.class.path" System property, and/or
listing the launcher app's actual class-loaders.


>He also said problems like this apparently occur with Web Start on Windows

You didn't mention Web Start on Windows before, or is that not relevant to
your problem, and only relevant to someone else's problem?

I'm getting confused about exactly what command-line you're using on any of
the platforms, or whether you're using Web Start, because now you're saying
that the examples you posted before were NOT the actual command-lines that
worked, and you've brought up Web Start which is a radically different
execution context and class-loader setup.

I'm also unsure of what's in launcher.jar's manifest file, since you didn't
describe its contents before.

First, I assume when you say "launch" you mean "execute within the same
process as the launcher itself".  If that's what you mean, is abc.jar
listed in the Class-Path attribute of launcher.jar's manifest?

If it isn't, then I'm pretty sure a simple URLClassLoader created in the
launcher process will NOT parse the Class-Path attribute in aaa.jar or any
of the other sub-jars.  I'm pretty sure that parsing is done by Sun's
sun.misc.Launcher$AppClassLoader, which is a URLClassLoader subclass that
is an app's normal ClassLoader.  See the output from ListClassLoaders.

If abc.jar isn't listed in launcher.jar's Class-Path attribute, are
aaa.jar, bbb.jar, and ccc.jar listed, or are they just presumed to reside
in the same location as launcher.jar?

It makes a difference because Class-Path manifest attributes aren't
necessarily recursively evaluated.  In most contexts, that may lead to
security problems.

All of this makes me wonder exactly what's in launcher.jar's manifest and
"launching" code.


>and people have to take extra precautions when loading (but why???? THAT'S
>what I want to know!) apps that have extra resources.

That sounds like a Windows-specific question, so now I wonder why you're
asking it on a Mac-specific list.


>If we take our jar files and then compile the libraries directly INTO the
>apps, which makes the apps uneccesarily large, IMHO, they all launch and
>run fine on all OSes. Separate out the library though, and SMACK!!! down it
>goes on Windows!!

Not all the time, because you originally said this worked:
  java -jar aaa.jar
when aaa.jar has "Class-Path: abc.jar" in its manifest.

So it's not JUST separating the library that breaks it, otherwise the
example above would flat-out fail.  It's something about separating the
library AND "launching" the sub-apps using a separate launcher.jar app.  In
other words, the strongest evidence I can see is that it all hinges on
exactly what's in launcher.jar, whose manifest and classes you haven't yet
described in the same detail as aaa.jar, bbb.jar, etc.

  -- GG


 _______________________________________________
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.