Eclipse JNI Help? [message #511058] |
Fri, 29 January 2010 16:29 |
Mark Cheung Messages: 18 Registered: July 2009 |
Junior Member |
|
|
Hi,
I have a simple file that looks like this:
package test;
package test;
public class Hello {
public native void sayHello();
static {
System.out.println("testing2");
System.loadLibrary("hello");
System.out.println("passed testing 2");
}
public static void main(String[] args) {
System.out.println("testing");
Hello h = new Hello();
h.sayHello();
}
}
I can run the class in command prompt with java -classpath C:\Docu...\CodeCount\src test.Hello and it prints "Hello World!"
However, when I try to run that from a view that I created, it failed (by calling the action).
class caction extends Action{
public caction(final String s){
super(s);
}
public void run(){
System.out.println("running");
IEditorPart ipart=(IEditorPart )getSite().getPage().getActiveEditor();
System.out.println(ipart.getClass().toString());
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
if(ipart.getClass().toString().equals("class org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor "))
{
System.out.println("java file");
}
System.out.println("???");
Hello test= new Hello();
System.out.println("passed");
showMessage("success");
}
}
terminal print-out:
running
class org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor
java file
???
testing2
I think it failed to load the library, since it never gets to passed testing 2. Can someone tell me how to fix this problem?
Any help would be appreciated.
Thanks,
MC
[Updated on: Fri, 29 January 2010 16:32] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03828 seconds