problem using native mthods

M

mohsen_fakhari

Hi
I've just learnt using JNI.
I'm writing a program that uses some native methods to do some of its
jobs.
After the program do its job completely I call System.exit(0) but a
'java.exe' remains in the processes
always and causes further problems.
This problem happens only when the program uses native methods.
What's wrong?
What should I do?
Any thing is appreciated
I'm using WinXP , jdk1.4 and JBuilder2005 if it can help.
 
K

kcwong

Hi
I've just learnt using JNI.
I'm writing a program that uses some native methods to do some of its
jobs.
After the program do its job completely I call System.exit(0) but a
'java.exe' remains in the processes
always and causes further problems.
This problem happens only when the program uses native methods.
What's wrong?
What should I do?
Any thing is appreciated
I'm using WinXP , jdk1.4 and JBuilder2005 if it can help.

The DLL might have problems unloading. Do you own the native source
code? If so, you can trace to see that the DLL can be unloaded
properly.

Most IDE have an "attach to process" that you can use to debug. Set
java.exe as the executable and provide the parameters (-classpath and
the main class name), then add break points in DLLMain.
 
M

mohsen_fakhari

thank you for your answer
Why a dll might have problems unloading when it returns good results
with no error?
I have written the C part(the dll)too.It is not so complicated.

I don't know how to debug the native parts at all.
Is it possible with JBuilder?
 
K

kcwong

thank you for your answer
Why a dll might have problems unloading when it returns good results
with no error?
I have written the C part(the dll)too.It is not so complicated.

I don't know how to debug the native parts at all.
Is it possible with JBuilder?

No, JBuilder only does Java.

Eclipse has a plugin for C++... it can be configured to use different
compilers. I don't have much experience with it though, and I think
the plugin is pretty new.
(Eclipse http://www.eclipse.org/)
(C++ Plugin http://www.eclipse.org/cdt/)

Also, Visual Studio 2005 Express is a free download. (http://
msdn2.microsoft.com/en-us/express/default.aspx) This free version
doesn't support a few things, like MFC and remote debug. But if you
don't need those then it's okay.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
VetaMcRae
Top