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. Advertisements

  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. Advertisements

  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. Advertisements

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. Alex Hunsley

    IBM's JNI fails where Sun's JNI works

    Alex Hunsley, Nov 3, 2003, in forum: Java
    Replies:
    4
    Views:
    1,107
    Alex Hunsley
    Nov 4, 2003
  2. Pasturel Jean-Louis

    Porting JNI Windows under JNI LINUX + Wine ?

    Pasturel Jean-Louis, Feb 29, 2004, in forum: Java
    Replies:
    5
    Views:
    1,198
    Pasturel Jean-Louis
    Mar 3, 2004
  3. Amit
    Replies:
    0
    Views:
    1,311
  4. MikL
    Replies:
    1
    Views:
    7,404
    Gordon Beaton
    Feb 15, 2005
  5. zorba
    Replies:
    2
    Views:
    2,951
    zorba
    Mar 23, 2005
  6. Patrice

    JNI delphi

    Patrice, Apr 4, 2005, in forum: Java
    Replies:
    1
    Views:
    962
    Stefan Schulz
    Apr 4, 2005
  7. Replies:
    1
    Views:
    7,264
    John B. Matthews
    May 1, 2009
  8. Olivier GROSSET-GRANGE

    JNI, threads are still running after DestroyJavaVM()

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