Doug, I'll put the patch in for sure. It will be in the next release.
If I understand correctly you are going from Java to Perl via JNI and then using Inline::Java to return to Java? If that is the case I'm really interested in knowing a bit more about your project. >From Inline::Java you can start from Perl and go to Java and then even callback to Perl, but often people ask me if the whole process can start in Java-land. I think JPL could do that, is that what you use to load up the PerlInterpreter in the first place? The CLASSPATH issue is always problematic. In your case it will be even more so because you will need to set it even before Tomcat or Weblogic starts. One thing that will interest you is that using Inline's NAME configuration parameter in combination with the DIRECTORY parameter in your 'use Inline Java' statement will give a more predictable path for the .class files: Ex: use Inline ( Java => "DATA", DIRECTORY => '/some/dir', NAME => 'MyStuff', ... ) ; This will place the class files in '/some/dir/lib/auto/MyStuff/' which might be better than something like '_Inline/lib/auto/test_pl_13db'. Cheers, Patrick --------------------- Patrick LeBoutillier Laval, Quebec, Canada ----- Original Message ----- From: "Doug MacEachern" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, December 14, 2002 9:58 PM Subject: [patch] embedded in java > i want to use Inline::Java inside a jvm that's already running (e.g. in > a server such as tomcat or weblogic). i have a PerlInterpreter jni > extension to embed the interpreter(s), to use Inline::Java from there in > the same jvm requires the patch below. then configuring JNI => 2: > use Inline => 'Java', ..., JNI => 2; > > one thing to be sorted out is adding the _Inline directory to the > classpath where InlineJavaServer.class, etc. are compiled (such as > _Inline/lib/auto/test_pl_13db). i'll give it a shot later if the concept > in this patch could be included in a future release? > > --- Java/JNI.xs~ Mon Jun 3 08:50:57 2002 > +++ Java/JNI.xs Sat Dec 14 18:42:20 2002 > @@ -17,6 +17,7 @@ > jmethodID process_command_mid ; > jint debug ; > int destroyed ; > + int embedded ; > } InlineJavaJNIVM ; > > > @@ -137,6 +138,7 @@ > RETVAL->ijs = NULL ; > RETVAL->debug = debug ; > RETVAL->destroyed = 0 ; > + RETVAL->embedded = SvIV(get_sv("Inline::Java::JVM", TRUE)) == 2 ? 1 : 0; > > options[0].optionString = ((RETVAL->debug > 5) ? "-verbose" : "-verbose:") ; > cp = (char *)malloc((strlen(classpath) + 128) * sizeof(char)) ; > @@ -148,8 +150,23 @@ > vm_args.nOptions = 2 ; > vm_args.ignoreUnrecognized = JNI_FALSE ; > > - /* Create the Java VM */ > - res = JNI_CreateJavaVM(&(RETVAL->jvm), (void **)&(env), &vm_args) ; > + if (RETVAL->embedded) { > + /* we are already inside a JVM */ > + jint n = 0; > + > + res = JNI_GetCreatedJavaVMs(&(RETVAL->jvm), 1, &n); > + env = get_env(RETVAL); > + RETVAL->destroyed = 1; /* do not shutdown */ > + > + if (n <= 0) { > + /* res == 0 even if no JVMs are alive */ > + res = -1; > + } > + } > + else { > + /* Create the Java VM */ > + res = JNI_CreateJavaVM(&(RETVAL->jvm), (void **)&(env), &vm_args) ; > + } > if (res < 0) { > croak("Can't create Java interpreter using JNI") ; > } > --- Java/JVM.pm~ Thu Jul 4 09:56:25 2002 > +++ Java/JVM.pm Sat Dec 14 18:41:10 2002 > @@ -37,7 +37,7 @@ > Inline::Java::debug(1, "starting JVM...") ; > > $this->{owner} = 1 ; > - if ($o->get_java_config('JNI')){ > + if (($Inline::Java::JVM = $o->get_java_config('JNI'))){ > Inline::Java::debug(1, "JNI mode") ; > > my $jni = new Inline::Java::JNI( >