how to reinitialize the jvm in jniport?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to reinitialize the jvm in jniport?

Tudor Girba-2
Hi,

I am trying to shutdown a Jvm instance but when I try to use a new instance, I get a "JNIError: unknown error".

Here is what I do on OS X using Pharo 3.0:

Gofer new
smalltalkhubUser: 'JNIPort' project: 'JNIPort';
configuration;
loadVersion: '3.0-baseline'.

JNIPortJNIInterface libraryFile: '/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libclient.dylib'.
jvm := JVM newWithDefaultSettings.
jvm findClass: 'java.lang.String'.
"==> public final java.lang.String
Instance class: JavaLangString
Static class: StaticJavaLangObject"

jvm shutdown. "with or without this line, the below error is the same"

anotherJvm := JVM newWithDefaultSettings.

==> "JNIError: unknown error"


What am I doing wrong?

Cheers,
Doru


--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: how to reinitialize the jvm in jniport?

Tudor Girba-2
Hi Joachim,

How can I drop or reinitialize the JVM reliably? The code from the previous message does not seem to work.

Cheers,
Tudor



On Fri, Aug 7, 2015 at 12:39 PM, Tudor Girba <[hidden email]> wrote:
Hi,

I am trying to shutdown a Jvm instance but when I try to use a new instance, I get a "JNIError: unknown error".

Here is what I do on OS X using Pharo 3.0:

Gofer new
smalltalkhubUser: 'JNIPort' project: 'JNIPort';
configuration;
loadVersion: '3.0-baseline'.

JNIPortJNIInterface libraryFile: '/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libclient.dylib'.
jvm := JVM newWithDefaultSettings.
jvm findClass: 'java.lang.String'.
"==> public final java.lang.String
Instance class: JavaLangString
Static class: StaticJavaLangObject"

jvm shutdown. "with or without this line, the below error is the same"

anotherJvm := JVM newWithDefaultSettings.

==> "JNIError: unknown error"


What am I doing wrong?

Cheers,
Doru


--

"Every thing has its own flow"



--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: how to reinitialize the jvm in jniport?

Joachim Geidel
Hi Tudor,

It is not possible to start a Java VM again in the same operating system process after shutting it down. You have to restart Pharo to do this. This is a restriction of the Java VM itself, not a restriction of JNIPort. The JVM specification also says that it should be possible to start more than one Java VM in the same operating system process, but Sun/Oracle has never implemented this feature.

HTH
Joachim

Tudor Girba-2 wrote
Hi Joachim,

How can I drop or reinitialize the JVM reliably? The code from the previous
message does not seem to work.

Cheers,
Tudor