NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Java Step Types with Java Virtual Machine higher than java-6u16?

Documentation of Java steps says, that these steps are tested with java version 6 update 16. I am talking about the java step types that can be found in directory <TestStand Public>\TestStand 2010\Examples\Java. 

 

If I install another java version, e. g. java 7, step "Start JVM" will exit with an error "-4" and error message "Could not launch JVM.". While Debugging source code of JavaCall.dll, I figured the failing code line out:

 

"fpCreateJVM(&jvm,(void**)&env,&vm_args);" is the execution of function "JNI_CreateJavaVM" and returns error code -4.

 

Till now I could not find out, why the jvm does not start. I guess -4 means "Insufficient memory to create the JVM." (https://www.ni.com/docs/en-US/bundle/teststand/page/error-codes-java.html)

 

Has anyone an advice for me?

0 Kudos
Message 1 of 4
(3,294 Views)

Are you actually running out of memory?

0 Kudos
Message 2 of 4
(3,290 Views)

Not at all. 2gb of ram are free. I changed the source code of JavaCall.dll and added parameters like "-Xms100m" and "-Xmx1024m" in order to set minimum and maximum ram the virtual machine should use. No new effect!

 

Perhaps I should try on another pc.

 

Does anyone use the Java step types with a higher java version?

0 Kudos
Message 3 of 4
(3,285 Views)

This post gave me a hint: http://stackoverflow.com/questions/3400292/jni-enomem-from-jni-createjavavm-when-calling-dll-that-us...

 

Though my development computer has enough ram, jvm is started within the Teststand process which offers limited memory. I changed JavaCall.c and added parameter "-Xmx64m" to the jvm creation call. Now it works with jre 7.

 

Because memory space Teststand offers to the jvm is different on different computers, an implementation would be nice that checks how much memory is available and then passes the calculated <MEM> as parameter "-Xmx<MEM>m". Here is an example implementation: https://forums.oracle.com/forums/thread.jspa?threadID=1546540

 

 

0 Kudos
Message 4 of 4
(3,273 Views)