Questions tagged [invocation-api]

The Invocation API allows software vendors to load the Java VM into an arbitrary native application.

9 questions
4
votes
2 answers

C-to-Java calls pass but JVM crashes in a weird/unexplained way

first question asked, so I'll get straight to it. I've got some C code that will be interfacing with Java; i did my homework on JNI and the topic. Here's the code: C-part: #include #include #include #define CLASSPATH…
Shark
  • 6,513
  • 3
  • 28
  • 50
2
votes
1 answer

jstring to char* in c usage not converting into printable format

I am running a simple JNI program using the Invocation API on z/os with C. The Java program has a simple sayHello() method like this- public static String sayHello(){ return "Hello World!!!"; } the code that calls this method and prints the…
User2709
  • 573
  • 5
  • 17
2
votes
3 answers

Access static enum fields using JNI invocation API

How can we access static enum fields using JNI invocation API I am trying to access glassfish org.glassfish.api.embedded.ContainerBuilder.Type enumeration from Glassfish api using following code jclass Type= env->FindClass( …
Xinus
  • 29,617
  • 32
  • 119
  • 165
1
vote
1 answer

The JVM crashes while printing the stacktrace

I want to convert an exception stacktrace to a string in C. I have this code: (main.c) #include #include #include #include int main() { JavaVM *jvm; JNIEnv *env; JavaVMInitArgs vm_args; JavaVMOption…
JCWasmx86
  • 3,473
  • 2
  • 11
  • 29
1
vote
0 answers

Is there a way to efficiently copy wrapped JNI objects in C++?

I'm using the JNI Invocation API in an attempt to wrap a Java library in C++. My C++ classes are essentially containers for JNI jobjects with setter/getter methods to call JNI and retrieve data from said jobjects. What I am trying to figure out is…
Ddor
  • 347
  • 1
  • 12
1
vote
1 answer

JNI invocation api: get method id for method with multiple parameters

I want to call java function from c++ which takes multiple parameters , I have tried following statement mid=env->GetMethodID(JDeployerClass,"deploy","(Ljava/io/File;,Lorg/glassfish/api/deployment/DeployCommandParameters;)Ljava/lang/String;"); But…
Xinus
  • 29,617
  • 32
  • 119
  • 165
1
vote
2 answers

Creating java executable using JNI?

I am trying to create executable under windows platform for Java program using JNI ,C/C++ and invocation API, I have already created jar file for my program which includes all dependencies. I want to embed it in exe file, I was successful in…
Xinus
  • 29,617
  • 32
  • 119
  • 165
1
vote
1 answer

Compile with VC++

I need to convert this gcc build command to VC++ g++ -o launcher.exe launcher.cpp -I C:/JDK/include_jdk -I C:/JDK/include_jdk/win32 -L C:/Program Files (x86)/Java/jre6/bin/client -ljvm I don't use VC++ at all (use mingw) and just have to compile…
Alf
  • 1,285
  • 3
  • 14
  • 24
0
votes
0 answers

Creating JVM within C++ class method loop - invocation API

I have wrapped a Java library into a C++ class library and wish to use this library within another C++ project. Specifically, I would like to use the library within a class method which reads in an input file, loops over all elements in the file,…
Ddor
  • 347
  • 1
  • 12