Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #15415

Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java

From clusardi2k@aol.com
Newsgroups comp.lang.java.programmer
Subject Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java
Date 2012-06-19 06:58 -0700
Organization http://groups.google.com
Message-ID <267bdc27-ad97-489f-ae3f-3b8f94b26880@googlegroups.com> (permalink)
References <34c3ac13-bfbe-44e1-befb-09a438cc4f8b@googlegroups.com>

Show all headers | View raw


Using the "-shared -m32" options, NetBeans does create the dot dll.

I put the folder containing the dot dll into the PATH environment variable.

But, when I press F6 to run, I get the following error message:

run:
java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: libJNIDemoCdl
	at java.lang.Runtime.load0(Runtime.java:789)
	at java.lang.System.load(System.java:1059)
	at jnidemojava.Main.<clinit>(Main.java:11)
Exception in thread "main" Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Below is Main.java file. I tried various paths to the dll:
-----
package jnidemojava;

public class Main {
    private native void nativePrint();
    
    public static void main(String[] args) {
        new Main().nativePrint();
    }
    
    static {
        System.load("libJNIDemoCdl");
        System.load("libJNIDemoCdl");
        System.load("libJNIDemoCdl");
        System.load("libJNIDemoCdl.dll");
        System.load("libJNIDemoCdl.dll");
        System.load("libJNIDemoCdl.dll");
        System.load("C:/Users/THE_USER/Documents/NetBeansProjects/JNIDemoCdl/dist/libJNIDemoCdl");
        System.load("C://Users//THE_USER//Documents//NetBeansProjects//JNIDemoCdl//dist//libJNIDemoCdl");
        System.load("C:\\Users\\THE_USER\\Documents\\NetBeansProjects\\JNIDemoCdl\\dist\\libJNIDemoCdl");
        System.load("C:/Users/THE_USER/Documents/NetBeansProjects/JNIDemoCdl/dist/libJNIDemoCdl.dll");
        System.load("C://Users//THE_USER//Documents//NetBeansProjects//JNIDemoCdl//dist//libJNIDemoCdl.dll");
        System.load("C:\\Users\\THE_USER\\Documents\\NetBeansProjects\\JNIDemoCdl\\dist\\libJNIDemoCdl.dll");
    }

}

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java clusardi2k@aol.com - 2012-06-15 11:57 -0700
  Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java clusardi2k@aol.com - 2012-06-18 21:03 -0700
    Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java "John B. Matthews" <nospam@nospam.invalid> - 2012-06-19 06:34 -0400
      Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java Arun GOPI <arun041@gmail.com> - 2012-07-16 03:07 -0700
      Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java Arun GOPI <arun041@gmail.com> - 2012-07-16 03:09 -0700
  Re: Using NetBeans 7.1.2 JNI: Windows 7 C and C++ Compiler Options clusardi2k@aol.com - 2012-06-19 06:01 -0700
  Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java clusardi2k@aol.com - 2012-06-19 06:11 -0700
  Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java clusardi2k@aol.com - 2012-06-19 06:58 -0700
  Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java clusardi2k@aol.com - 2012-06-19 07:18 -0700
  Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java clusardi2k@aol.com - 2012-06-19 07:25 -0700
  Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java clusardi2k@aol.com - 2012-06-19 08:27 -0700
    Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java clusardi2k@aol.com - 2012-06-19 08:35 -0700
      Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java clusardi2k@aol.com - 2012-06-19 08:53 -0700
        Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java clusardi2k@aol.com - 2012-06-19 09:20 -0700
  Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java clusardi2k@aol.com - 2012-06-20 10:56 -0700
  Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java Lew <lewbloch@gmail.com> - 2012-06-20 11:49 -0700
    Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java "John B. Matthews" <nospam@nospam.invalid> - 2012-06-21 22:35 -0400
      Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java Lew <noone@lewscanon.com> - 2012-06-21 21:39 -0700
        Re: Using NetBeans 7.1.2 JNI: Where Is a Good Tutorial on How to Invoke C++ from Java "John B. Matthews" <nospam@nospam.invalid> - 2012-06-23 00:16 -0400

csiph-web