Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: clusardi2k@aol.com Newsgroups: comp.lang.java.programmer Subject: Using JNI to Invoke C++ Method from Java via NetBeans 7.1.2 (Question: How to Import Stuff?) Date: Thu, 14 Jun 2012 12:43:30 -0700 (PDT) Organization: http://groups.google.com Lines: 67 Message-ID: <5b852d14-dd46-463e-9d13-7602e17c151f@googlegroups.com> NNTP-Posting-Host: 198.151.13.60 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1339703343 10272 127.0.0.1 (14 Jun 2012 19:49:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 14 Jun 2012 19:49:03 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=198.151.13.60; posting-account=r24XpwkAAABfAJg5TJRsTScS4AL5MjOT User-Agent: G2/1.0 X-Received-Bytes: 3431 Xref: csiph.com comp.lang.java.programmer:15290 Hello, I want to call a series of C++ routines from java using the Java Native Int= erface. The IDE that I'm using is NetBeans 7.1.2. Below is a two part description. The first part is background. It explains = how I was told to setup two jar files that refer to my C++ routines. The se= cond part is the wrong part. The second part is my feeble attempt at changi= ng my code so that it invokes a routine in the C/C++ library. (Part 1) I setup NetBeans to use 2 dot jar files to refer to my C++ class'. I was to= ld to follow these steps. The steps that I followed to do this are.=20 Start NetBeans, highlight the name of the current project, right click on i= t, select Add Library, select Create..., name the library MY_TEST, click ok= , press the "Add JAR/Folder..." button, and select the two jar files that w= ere given to me. The 2 jar files now appear on the left side of the IDE under MY_TEST. Below= that is a description of each method in the file. This is what appears on = the left of the IDE: Libraries MY_TEST - name_of_jar_file1.jar META-INF MANIFEST.MF one.very.long.dotted.thing MY_TEST - name_of_jar_file2.jar META-INF MANIFEST.MF one.very.long.dotted.widget Beans Binding - beansbinding-1.2.1.jar JDK 1.7 (Default) At this point, is it possible to just import one of the class' in the jar f= ile, instantiate it, and then call the method desired. How would I go about= doing this? (Part 2) 0) FYI: There is only one class in this simple dot java program.=20 1) Without instantiating a class listed in one of the dot jar files, I put = a call to a method (my_one_test) listed in one of the jar files (my_test do= es not exist anywhere else), 2) in the same dot java file, I created the following routine prototype for= my_one_test: "private native void my_one_test()", and=20 3) at the start of the class (in the dot java program), I added the lines: static { System.load ("C:\\User_name_0\\dist\\lib\name_of_jar_file1.jar"); System.load ("C:\\User_name_0\\dist\\lib\name_of_jar_file2.jar"); }=20 This compiles, but I get the following runtime error: java.lang.UnsatisfiedLinkError: C:...\dist\lib\name_of_jar_file1.jar: Can't= load this .dll (machine code=3D0x23) on a IA 32-bit platform What do I do. Would creating a dot h file help. Thanks, First Time JNI user