Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Using JNI to Invoke C++ Method in Java via IDE NetBeans 7.1.2

Reply
Thread Tools

Using JNI to Invoke C++ Method in Java via IDE NetBeans 7.1.2

 
 
clusardi2k@aol.com
Guest
Posts: n/a
 
      06-14-2012
Hello,

I want to call a series of C++ routines from java using the Java Native Interface. 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 second part is the wrong part. The second part is my feeble attempt at changing 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++ routines. I was told to follow these steps. The steps that I followed to do this are.

Start NetBeans, highlight the name of the current project, right click on it, 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 were given to me.

The 2 jar files now appear on the left side of the IDE under MY_TEST. Belowthat is a description of each method in the file.

(Part 2)
0) FYI: There is only one class in this simple dot java program.
1) I put a call to a method (my_test) listed in one of the jar files (my_test does not exist anywhere else),
2) in the same dot java file, I created the following routine prototype formy_test:

"private native void my_test()", and

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 ");
}

This compiles, but I get the following runtime error:

java.lang.UnsatisfiedLinkError: C:...\dist\lib\name_of_jar_file1.jar: Can'tload this .dll (machine code=0x23) on a IA 32-bit platform

What do I do. Would creating a dot h file help.

Thanks,
First Time JNI user
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using JNI to Invoke C++ Method from Java via NetBeans 7.1.2 clusardi2k@aol.com Java 2 06-14-2012 08:20 PM
Using JNI to Call C++ Methods from Java Using NetBeans IDE 7.1.2 clusardi2k@aol.com Java 0 06-14-2012 07:17 PM
Using JNI (to get C++ routines) with Java : NetBeans IDE 7.1.2 clusardi2k@aol.com Java 0 06-14-2012 07:12 PM
Python IDE like NetBeans/Delphi IDE fowlertrainer@anonym.hu Python 5 04-06-2005 05:56 AM
Building a GUI using NetBeans platform (not Netbeans IDE !) Pimousse Java 2 04-21-2004 07:22 AM



Advertisments