Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: java JNI help required

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    5
    My Mood
    Cheerful
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java JNI help required


    Hi All,
    May i know how to create c header file using java jni for a class which is inside a jar file.
    I have created a jar called HelloWorld.jar (using Netbeans) which has only class file as below

    package example;

    public class HelloWorld {
    public native void print(); //native method
    static //static initializer code
    {
    System.loadLibrary("CLibHelloWorld");
    }

    public static void main(String[] args)
    {
    HelloWorld hw = new HelloWorld();
    hw.print();
    }
    }

    i tried following command
    javah -jni HelloWorld
    i am getting below error
    error: cannot access HelloWorld
    class file for HelloWorld not found
    javah -jni example.HelloWorld
    i am getting below error
    error: cannot access HelloWorld
    class file for HelloWorld not found

    Please let me know how to create the c header file.


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: java JNI help required

    Please don't post the same question more than once. This is unfair to the volunteers who answer questions in this forum. Locking this post.

Similar Threads

  1. Java Developer required!
    By Rilwood in forum Paid Java Projects
    Replies: 0
    Last Post: December 3rd, 2012, 11:36 AM
  2. calling native c code from java using JNI
    By ashok_jeev in forum Java Native Interface
    Replies: 3
    Last Post: November 20th, 2012, 05:28 AM
  3. Replies: 1
    Last Post: June 26th, 2012, 12:04 AM
  4. New to Java....still learning...Help Required
    By muraduk in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 12th, 2010, 03:15 PM
  5. Java newbie...Help required
    By muraduk in forum What's Wrong With My Code?
    Replies: 3
    Last Post: August 12th, 2010, 03:15 PM

Tags for this Thread