Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » Eclipse JNI Help?(JNI with plug-in view testing)
Eclipse JNI Help? [message #511058] Fri, 29 January 2010 16:29 Go to next message
Mark Cheung is currently offline Mark CheungFriend
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

Re: Eclipse JNI Help? [message #511453 is a reply to message #511058] Mon, 01 February 2010 15:59 Go to previous message
Eugene Chan is currently offline Eugene ChanFriend
Messages: 287
Registered: July 2009
Senior Member
Hi,

I suggest you try post this question to a general Java newsgroup.
A quick scan on your posting and I suggest you to check if your hello
library exists. You can also try debug mode and set a break point a the
loadLibrary line to step thru the exection.

Eugene

"Mark Cheung" <iammark1237@yahoo.com> wrote in message
news:hjv2dc$fqb$1@build.eclipse.org...
> Hi,
> I have a simple file that looks like this:
>
> package test;
>
> public class Hello {
> public native void sayHello();
>
> static {
> System.out.println("testing2");
> System.loadLibrary("hello");
> }
> 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("SLOC Computed");
> }
> }
> 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 testing. Can
> someone tell me how to fix this problem?
>
>
Previous Topic:guide for analyzing Object allocation
Next Topic:web service instrumentation with probekit
Goto Forum:
  


Current Time: Fri Apr 26 05:34:34 GMT 2024

Powered by FUDForum. Page generated in 0.03828 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top