Article View: borland.public.jbuilder.java.language
Article #8452Re: JNI Question: Calling java methods from c (not callbacks)
From: Tim Dietz
Date: Thu, 22 Mar 2001 17:19
Date: Thu, 22 Mar 2001 17:19
37 lines
2339 bytes
2339 bytes
How about posting the relevant portion of code. I've got my callback working just fine. "Ricard Gonzalez Bringue" <gonzalez@eq.upc.es> wrote in message news:3AB9B790.421AA49B@eq.upc.es... > Hi Everybody, > I'm a newbie at Java Native Code. > I would like to know how to call java methods from C, without creating > the JVM from the native side, > I have the following system: > > Client C native DLL Java > Application > > I would like to make the java application behave as a server so it could > attend the client requests (from C). > > My order of execution is: > 1. Start java application. > 2. Java loads the DLL. > 3. Java can make invocations of DLL methods, in fact it does. > 4. The problem, I would like to enable C client to use DLL and call > java methods. > In the sample from Sun, Java calls C native methods and then this > function calls back Java. This function uses JNIEnv and jobject passed > by parameter so it has no problem in calling Java again. > The problem is, how to call Java methods from C native code. I tried to > saved the parameters JNIEnv and jobject and saved it as public > variables, so that any function can use it and make a Java method > invocation, but it doesn't work. > > I'm using jdk1.3.System Operating is Windows NT. > What am I doing wrong?? Must I start the JVM from the native side?? > Thank you in advance. > Ricard >
Technical Details
Message-ID:
<3aba3447$1_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!bignews.mediaways.net!diablo.theplanet.net!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!207.110.36.206References:
<3AB9B790.421AA49B@eq.upc.es>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,e5c82d4cfa4e0f3,start X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-23 04:05:12 PST From: "Tim Dietz" <tdietz@telena.com> Newsgroups: borland.public.jbuilder.java.language References: <3AB9B790.421AA49B@eq.upc.es> Subject: Re: JNI Question: Calling java methods from c (not callbacks) Date: Thu, 22 Mar 2001 09:19:34 -0800 Lines: 39 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 207.110.36.206 Message-ID: <3aba3447$1_1@dnews> X-Trace: 22 Mar 2001 09:20:07 -0800, 207.110.36.206 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!bignews.mediaways.net!diablo.theplanet.net!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!207.110.36.206