error porting JNI programs from Windows to Sparc Solaris 10



hi,

I have a JNI program which runs correctly on windows XP jdk1.4.2_07.
But when I port the program to Sparc blade 100 Solaris 10, I get a
error when invoking the jvm. the jdk on solaris is jdk1.5.0_01. The
code is as follows:

I gdbed the program and know the code goes into JNI_VERSION_1_2 branch
and error occurs at JNI_createJavaVM. This piece of code rans correctly
on windows xp.

int InvokeJVM( JVM *jvm, const char *classpath )
{
jint res = 0;

#ifdef JNI_VERSION_1_2
JavaVMInitArgs vm_args;
JavaVMOption options[2];

char cpath[1024];
memset( cpath, 0, sizeof(cpath));
sprintf( cpath, "-Djava.class.path=%s", classpath );
options[0].optionString = cpath;
options[1].optionString = "-Xmx64m";

memset( &vm_args, 0, sizeof( vm_args ));
vm_args.version = JNI_VERSION_1_2;
vm_args.options = options;
vm_args.nOptions = 2;
vm_args.ignoreUnrecognized = JNI_FALSE;

/* Create the Java VM */
res = JNI_CreateJavaVM( &(jvm->jvm), (void**)&(jvm->jenv),
&vm_args ); // error invoking
#else
JDK1_1InitArgs vm_args;
char classpath[1024];
vm_args.version = 0x00010001;
JNI_GetDefaultJavaVMInitArgs( &vm_args );
sprintf( classpath, "%s%c%s",
vm_args.classpath, PATH_SEPARATOR, &vm_args);
vm_args.classpath = classpath;

/* Create the Java VM */
res = JNI_CreateJavaVM( &(jvm->jvm), &(jvm->jenv), &vm_args);
#endif
if ( res < 0 ) {
fprintf( stderr, "error invoking java VM with code: %d\n", res );
}
return res;
}

Any comments?
-Bruce

.



Relevant Pages

  • Re: trim function dumping core
    ... If this code works on Linux, Solaris, and Windows, than the day you wrote that code was one of your luckiest days;-)) ... char *rtrim; ...
    (comp.lang.c)
  • Re: FTC Complaint filed
    ... I am playing around with Solaris and zones, and attempting to run the DOS/Win3.1,'95/98/98SE apps, each in it's own zone if needed, using WINE. ... There's nothing wrong with COBOL but there are a lot of alternatives better suited for quick-and-dirty programming on the PC. ... I have long said, in my opinion and pre-Vista, that Windows 95 was the best OS Microsoft ever made. ...
    (microsoft.public.windowsmedia.player)
  • Re: Those little dots
    ... > Marlett font char 'n' is thte one Windows uses. ... I thought it was unicode character $2022 of font Tahoma. ... Windows XP displays the dot. ...
    (borland.public.delphi.language.objectpascal)
  • Re: This showed up last night... What is it?!
    ... Zonealarm said "Rundll32.exe wants access to the Internet" I thought ... There also seemed to be an explorer.exe in my windows directory. ... On the mentions of IRC. ... > 25495 Char 10 goto start ...
    (comp.security.firewalls)
  • Re: OT: Comparison of Unix systems and window managers
    ... Interesting that the system board date is unset in the Ultra-60: ... The machine was also plenty fast enough to run Solaris 10 ... used from Windows 95 until Windows 2000 Professional. ... use reliable pre-compiled packages if I can, ...
    (rec.crafts.metalworking)