Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » jni library help?
jni library help? [message #519460] Mon, 08 March 2010 16:39 Go to next message
Eclipse UserFriend
Hi,

Hi,
so I try calling a method (C) in my jni library for testing.

The java method is as followed:
public void call()
{
System.out.println("testing 3");
Hello h = new Hello();
h.sayHello();
System.out.println("testing 3 passed");
}

//File: Hello.c
#include <jni.h>
#include "Hello.h"
#include <stdio.h>
JNIEXPORT void JNICALL Java_test_Hello_sayHello
(JNIEnv *env, jobject obj)
{
printf("Hello world!\n");
return;
}

However, it seems that h.sayHello method is called only after I closed the plug-in.
print-out:
testing 3
testing 3.5 passed
testing 4 passed
passed
Hello world! ....

How can I call it without closing the plug-in?

Thanks,
MC
Re: jni library help? [message #520084 is a reply to message #519460] Thu, 11 March 2010 01:27 Go to previous messageGo to next message
Eclipse UserFriend
You might have to flush the stdout.
Try the line
fflush(stdout)
after the printf in you C program.
Re: jni library help? [message #521507 is a reply to message #520084] Wed, 17 March 2010 16:25 Go to previous message
Eclipse UserFriend
that worked!

Thanks
Previous Topic:Error dialog on startup
Next Topic:Can the JFileChooser's starting directory be set to the project or workspace folder?
Goto Forum:
  


Current Time: Tue Apr 15 02:52:27 EDT 2025

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

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

Back to the top