Article View: comp.lang.java.programmer
Article #674Re: JNI program example, need urgent help
From: Shayne Flint
Date: Sun, 25 Jan 1998 00:00
Date: Sun, 25 Jan 1998 00:00
45 lines
1991 bytes
1991 bytes
Juan Pedro Barbancho Manchon wrote:
>
> Dear sir,
> I use the JNI sun example, It compile and build a .exe, but no run well.
>
> The code:
>
Snip
>
> The error:
>
> can't fing Prog class
>
> The . is in the classpath, Prog.class is in . directory.
>
> Please, send me faster, Thank you
>
> mail: ct2bamaj@uco.es
>
This is a common problem that comes up on this news group every week.
The answer is in the doco somewhere, but here it is again.
You need to set the class path in vm_args. Something like this:
vm_args.version = 0x00010001;
res = JNI_GetDefaultJavaVMInitArgs(&vm_args);
if ( res < 0 )
printf("Error on getting default JavaVM initialization args\n");
vm_args.classpath=getenv("CLASSPATH"); /******* NOTE THIS BIT *****/
res = JNI_CreateJavaVM(&jvm, &env, &vm_args);
regards
--
------------------------------------------------------------------
-- Shayne Flint, MIEAust, CPEng shayne@ainslie-software.com
-- Ainslie Software Pty Limited http://www.ainslie-software.com
--
-- ShapeDB, a database and form drawing add-on for Visio
------------------------------------------------------------------
Technical Details
Message-ID:
<34CAC433.7DF9@ainslie-software.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34C5CC4E.5D6E16FC@uco.es>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10a146,4658fe8c72f49849 X-Google-Attributes: gid10a146,public X-Google-Thread: 113ae9,4658fe8c72f49849 X-Google-Attributes: gid113ae9,public X-Google-Thread: 1116f3,4658fe8c72f49849 X-Google-Attributes: gid1116f3,public From: Shayne Flint <shayne@ainslie-software.com> Subject: Re: JNI program example, need urgent help Date: 1998/01/25 Message-ID: <34CAC433.7DF9@ainslie-software.com> X-Deja-AN: 319014015 Content-Transfer-Encoding: 7bit References: <34C5CC4E.5D6E16FC@uco.es> Content-Type: text/plain; charset=us-ascii Organization: Ainslie Software Pty Limited Mime-Version: 1.0 Reply-To: shayne@ainslie-software.com Newsgroups: comp.lang.java.programmer,comp.lang.java.help,es.comp.lenguajes.java