This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help in javah

 
Vishal Gautam
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am a newbee to java and jni

I have following code


package com.vishal.practice;
import java.io.PrintWriter;
public class NativeDemo
{
int i;
public static void main(String[] args)
{
NativeDemo ob = new NativeDemo();

ob.i = 10;
PrintWriter pw = new PrintWriter(System.out);
pw.write("Before: " + ob.i);
ob.test();
pw.write("After: " + ob.i);
}

public native void test();

static
{
System.loadLibrary("NativeDemo");
}
}



I have compiled the code to build .class file

when I try to execute the following command

javah -jni com.vishal.practice NativeDemo

I get the following error

Error: Class com.vishal.practice.NativeDemo could not be found.

Not Sure what the reason is.

Please Help

Regards
Vishal
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


[b]I am a newbee to java and jni</b>

I think that jni is not a beginner topic. However, I wonder if your problem is in the way you are using the command rather than with your code. What if you put a dot before NativeDemo? Like this:

javah -jni com.vishal.practice.NativeDemo
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic