Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.uni-stuttgart.de!news.belwue.de!LF.net!news.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.java.programmer Subject: Re: JNI accessing a class that instantiates another class Date: Mon, 15 Aug 2011 21:50:54 +0200 Lines: 21 Message-ID: <87vctyxxlt.fsf@mid.deneb.enyo.de> References: <871uwma9kd.fsf@mid.deneb.enyo.de> <391b55eb-b8cc-413e-9c58-21ce7e81b934@v7g2000vbk.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ruchba.enyo.de 1313437854 25097 172.17.135.6 (15 Aug 2011 19:50:54 GMT) X-Complaints-To: news@enyo.de Cancel-Lock: sha1:d76FR4OOh/bAV/CoHMxzDora9X8= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7129 * Danno: > Thank you for taking the time to reply to my post. I have attached my > code below. I have not used -Xcheck:jni before. I may not fully > understand how to use it, but the way I understand it, it is a command > line argument. The java program, however, is not being called from a > command line. I have a MicroFocus COBOL program that is calling a C++ > dll that starts a JVM and invokes a Java method via JNI. Is there a > way to run -Xcheck:jni under that scenario? The JVM cannot be linked into all processes as a library, at least on UNIX-like platforms. I'm not sure if Windows is different in this regard. In your case, the JVM does not seem to properly support exception handling. There are options that supposedly increase compatibility, see the JVM documentation. > options[0].optionString = "-Djava.class.path=."; I think you have to put "-Xcheck:jni" here, as an additional option.