JNI for DELPHI : DestroyJavaVM Problem

Discussion in 'Java' started by zorba, Mar 21, 2005.

  1. zorba

    zorba Guest

    I am using Delphi to call Java methods using JNI. It works fine on
    the first run - Create JVM - find class and method - call method -
    Free JMV. However when i call it for a second time i get an error code
    of -1 when trying to create the JVM.

    I think the reason for this is that the com+ dll object we use is not
    shoutdown when the client is shut down as many different app use that
    dll??
    This may have absolutley no baring on the problem but i thought i
    would mention it.

    I have tried to use DestroyJavaVM when finished with it but it does
    not appear to work, as i still get the above error of -1 when creating
    the JVM.
    I have also tried to see if the JVM is already running and not create
    a new one if it is. (Not confident that i coded this correctly)

    Can anyone help

    Cheers
     
    zorba, Mar 21, 2005
    #1
    1. Advertising

  2. On 21 Mar 2005 07:11:32 -0800, zorba wrote:
    > I am using Delphi to call Java methods using JNI. It works fine on
    > the first run - Create JVM - find class and method - call method -
    > Free JMV. However when i call it for a second time i get an error
    > code of -1 when trying to create the JVM.


    According to the documentation for DestroyJavaVM, "The JVM still does
    not support unloading".

    If you need to make multiple calls into a JVM from native code, start
    one and keep it alive until the process terminates.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
     
    Gordon Beaton, Mar 21, 2005
    #2
    1. Advertising

  3. zorba

    zorba Guest

    Thank you

    Gordon Beaton <> wrote in message news:<>...
    > On 21 Mar 2005 07:11:32 -0800, zorba wrote:
    > > I am using Delphi to call Java methods using JNI. It works fine on
    > > the first run - Create JVM - find class and method - call method -
    > > Free JMV. However when i call it for a second time i get an error
    > > code of -1 when trying to create the JVM.

    >
    > According to the documentation for DestroyJavaVM, "The JVM still does
    > not support unloading".
    >
    > If you need to make multiple calls into a JVM from native code, start
    > one and keep it alive until the process terminates.
    >
    > /gordon
     
    zorba, Mar 22, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amit
    Replies:
    0
    Views:
    1,021
  2. MikL
    Replies:
    1
    Views:
    6,283
    Gordon Beaton
    Feb 15, 2005
  3. zorba
    Replies:
    2
    Views:
    2,559
    zorba
    Mar 23, 2005
  4. Replies:
    1
    Views:
    5,668
    John B. Matthews
    May 1, 2009
  5. Olivier GROSSET-GRANGE

    JNI, threads are still running after DestroyJavaVM()

    Olivier GROSSET-GRANGE, Feb 19, 2013, in forum: Java
    Replies:
    2
    Views:
    1,022
Loading...

Share This Page