Click here to Skip to main content
15,991,072 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HI,
I have a following scenario.
1. Have 3 components. C## App, C++ dll, a .jar file
2. The c++ application executes the jar file using JNI Invocation and gives me a result.
3. The C# app triggers the call to the c++ method.

Having no issues in executing the c++ independently, but when testing the complete process facing error in Creating the NewObject in JNI. Fails with a NULL error

Would like to know if anyone has gone through this..

What I have tried:

Have tried clearing the
env->DeleteLocalRef(objname);
env->DeleteGlobalRef(objname);
env->DeleteWeakGlobalRef(objname);
Posted
Updated 2-Jul-24 4:20am
v2
Comments
Richard Deeming 2-Jul-24 3:55am    
If there's no error, then how exactly does it "fail"?

What have you done to diagnose the problem?

At a guess, it could be environment variables, or a 32-bit/64-bit issue. But with such limited information, there's really not much anyone can do to help.
Avinash R Mys 2-Jul-24 10:27am    
returns NULL
Malcolm Arthur McLean 2-Jul-24 5:40am    
Have you tried this with a "hello world" jar file?
Richard MacCutchan 2-Jul-24 6:22am    
If you are "facing error in Creating the NewObject in JNI.", then how can it fail without error? You need to show some actual code and explain where the problem occurs. Please use the Improve question link above, and add complete details.
Richard Deeming 2-Jul-24 10:28am    
"Fails with a NULL error"

Well, that's no more help than your original description!

Don't try to "summarise" the error; provide the complete error message, and the relevant parts of your code.

1 solution

Your problem is clearly in the jar Files. So you need to carefully inspect the code which is failing with its error message. One common issue is that the class or some dependency (like member) you want to instanciate isnt public.
Make some error handling like excpeption code with some output to get more.

A very common issue is that you havent installed the correct version of Java. Try to execute the java code at the command line or some debugger. (and not in the JNI)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900