jvm class path unicode native methods  
Author Message
timprepscius





PostPosted: 2008-4-24 4:27:00 Top

java-programmer, jvm class path unicode native methods Okay.. I'm having the following problem.. I've tried pretty much every
solution I can think of but always hit some brick wall.

I need to:
load classes from a jar in a unicode directory and register native
methods for those classes.

Before (the unicode) I was simply doing a -Djava.class.path=myjar.jar
And then registering the native methods..

But.. I can't find a way to send a unicode code string to through the
-Djava.class.path..

So I've tried:

1. sending the string as utf8.. nope.
2. setting environment variable classpath with
SetEnvironmentVariableW.. nope.
3. creating my own url class loader with the jar..
Loads fine.. BUT NATIVE METHODS DO NOT REGISTER CORRECTLY (even
though the jnienv says they do.. they don't.. apparently I can only
register native methods from classes loaded from the jnienv_ sucky..)

4. creating my own url class loader that loads the byte code directly
from the jar, then calls defineClass from the root class loader.
NOPE.. because classes reference each other.. therefore the entire
jar must be available when ever I reference one class.

5. found out the class Launcher and its methods getClassLoader,
appendblahblahfor instrumentation..
NOPE.. although.. I've sort of giving up now.. this is going too far.

Any help?
Surely there are some japanese programmers that have dealt with this
before.

-tim
 
timprepscius





PostPosted: 2008-4-25 0:30:00 Top

java-programmer >> jvm class path unicode native methods On Apr 23, 4:27 pm, timprepscius <email***@***.com> wrote:
> Okay.. I'm having the following problem.. I've tried pretty much every
> solution I can think of but always hit some brick wall.
>
> I need to:
> load classes from a jar in a unicode directory and register native
> methods for those classes.
>
> Before (the unicode) I was simply doing a -Djava.class.path=myjar.jar
> And then registering the native methods..
>
> But.. I can't find a way to send a unicode code string to through the
> -Djava.class.path..
>
> So I've tried:
>
> 1. sending the string as utf8.. nope.
> 2. setting environment variableclasspathwith
> SetEnvironmentVariableW.. nope.
> 3. creating my own url class loader with the jar..
> Loads fine.. BUT NATIVE METHODS DO NOT REGISTER CORRECTLY (even
> though the jnienv says they do.. they don't.. apparently I can only
> register native methods from classes loaded from the jnienv_ sucky..)
>
> 4. creating my own url class loader that loads the byte code directly
> from the jar, then calls defineClass from the root class loader.
> NOPE.. because classes reference each other.. therefore the entire
> jar must be available when ever I reference one class.
>
> 5. found out the class Launcher and its methods getClassLoader,
> appendblahblahfor instrumentation..
> NOPE.. although.. I've sort of giving up now.. this is going too far.
>
> --
>
> Any help?
> Surely there are some japanese programmers that have dealt with this
> before.
>
> -tim

I've gotten this to work my manipulating the system class loader.. but
it's so sucky.. any better ideas?

bump
 
timprepscius





PostPosted: 2008-4-25 21:53:00 Top

java-programmer >> jvm class path unicode native methods On Apr 24, 12:30 pm, timprepscius <email***@***.com> wrote:
> On Apr 23, 4:27 pm, timprepscius <email***@***.com> wrote:
>
>
>
> > Okay.. I'm having the following problem.. I've tried pretty much every
> > solution I can think of but always hit some brick wall.
>
> > I need to:
> > load classes from a jar in a unicode directory and register native
> > methods for those classes.
>
> > Before (the unicode) I was simply doing a -Djava.class.path=myjar.jar
> > And then registering the native methods..
>
> > But.. I can't find a way to send a unicode code string to through the
> > -Djava.class.path..
>
> > So I've tried:
>
> > 1. sending the string as utf8.. nope.
> > 2. setting environment variableclasspathwith
> > SetEnvironmentVariableW.. nope.
> > 3. creating my own url class loader with the jar..
> > Loads fine.. BUT NATIVE METHODS DO NOT REGISTER CORRECTLY (even
> > though the jnienv says they do.. they don't.. apparently I can only
> > register native methods from classes loaded from the jnienv_ sucky..)
>
> > 4. creating my own url class loader that loads the byte code directly
> > from the jar, then calls defineClass from the root class loader.
> > NOPE.. because classes reference each other.. therefore the entire
> > jar must be available when ever I reference one class.
>
> > 5. found out the class Launcher and its methods getClassLoader,
> > appendblahblahfor instrumentation..
> > NOPE.. although.. I've sort of giving up now.. this is going too far.
>
> > --
>
> > Any help?
> > Surely there are some japanese programmers that have dealt with this
> > before.
>
> > -tim
>
> I've gotten this to work my manipulating the system class loader.. but
> it's so sucky.. any better ideas?
>
> bump

So the way I've gotten it to work post 1.5.1 is to get the system
class loader
get the "Laucher" object with method "getLauncher" getting the
AppClassLoader with "getClassLoader" and calling addURL (because
appendblahblahforinstrumentation) doesn't exist before 1.6.? .

BUT.. This doesn't work with version < 1.5.0.004..

Any ideas on how to specify a jar for the jvm in a unicode class path?

Nobody has dealt with this?

-tim