Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35452

Re: How do I terminate a JVM properly?

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Nigel Wade <nmw@local.domain>
Newsgroups comp.lang.java.programmer
Subject Re: How do I terminate a JVM properly?
Date Thu, 25 Aug 2016 13:52:01 +0100
Lines 64
Message-ID <e287viFdr8sU1@mid.individual.net> (permalink)
References <dd3f22ed-83df-4f1d-8a4a-180fa6ee12c2@googlegroups.com> <10fc56da-c03f-41a7-93b8-c7eeb6d24279@googlegroups.com> <npl47i$1ps$1@dont-email.me> <7b27f662-d2e0-4649-8e4d-5e14e790bd14@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net Nh4NpTa4VxK3cfqqj+AHZQLGGPI7zD+9J0nGsZSmNctxGAjyXt
Cancel-Lock sha1:mdub5q9t1GodBvnTKKzFgmnAvVc=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2
In-Reply-To <7b27f662-d2e0-4649-8e4d-5e14e790bd14@googlegroups.com>
Xref csiph.com comp.lang.java.programmer:35452

Show key headers only | View raw


On 25/08/16 13:24, Eric Douglas wrote:
> On Wednesday, August 24, 2016 at 5:40:23 PM UTC-4, Eric Sosman wrote:
>>> Appears to be a bug in the JRE?  I tried the simplest program, [...]
>>
>>      Code?
>
> I mean as simple as simple can be.  There's a JNLP pointing to a test server set up on IIS.

In your original post you stated that:
"After I dispose the last GUI object the JVM should terminate itself."

Indeed it should. But where exactly, in the code below, do you dispose of the GUI objects you've created?
(FYI, close != dispose).

The EDT will not exit as long as there are displayable components left which the JVM is managing.
(displayable != visible).


>
> <?xml version="1.0" encoding="utf-8"?>
> <jnlp spec="6.0+" codebase="http://myserver.mydomain.com/MyWebRoot/" href="Public/Test.jnlp">
> <security>
>      <all-permissions/>
> </security>
> <resources>
>      <j2se version="1.8+" initial-heap-size="128m"/>
>      <jar href="Public/Test.jar"/>
> </resources>
> <application-desc main-class="com.javatest.SimpleTest">
> </application-desc>
> </jnlp>
>
> and that jar packaged in that one class.
> package com.javatest;
>
> import java.awt.EventQueue;
>
> import javax.swing.JDialog;
>
> public class SimpleTest {
>      public SimpleTest() {
>           EventQueue.invokeLater(new Runnable() {
>
>                @Override
>                public void run() {
>                     showGui();
>                }
>           });
>      }
>
>      public static void main(String[] args) {
>           new SimpleTest();
>      }
>
>      private void showGui() {
>           final JDialog frame = new JDialog();
>           frame.setTitle("Testing");
>           frame.setVisible(true);
>      }
>
> }
>
> The JVM does terminate itself if I set Java in the Control Panel to hide the console, but if that console is visible it stays open deadlocked until I hit the Close button.  In our regular application I can run with the console window visible and it disappears when the program ends, but we're starting from a third party jar so I can only guess they're calling System.exit().  I assume this is why no one cares that the JVM doesn't terminate, because end users normally hide the console window.  I'm used to that window disappearing on it's own so when I wrote a standalone program and it didn't disappear I assume I missed something or it's a bug.
>

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How do I terminate a JVM properly? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-24 08:14 -0700
  Re: How do I terminate a JVM properly? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-24 14:00 -0700
    Re: How do I terminate a JVM properly? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-24 17:39 -0400
      Re: How do I terminate a JVM properly? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-25 05:24 -0700
        Re: How do I terminate a JVM properly? Nigel Wade <nmw@local.domain> - 2016-08-25 13:52 +0100
          Re: How do I terminate a JVM properly? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-25 06:05 -0700
            Re: How do I terminate a JVM properly? Nigel Wade <nmw@local.domain> - 2016-08-25 15:04 +0100
              Re: How do I terminate a JVM properly? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-25 08:20 -0700
            Re: How do I terminate a JVM properly? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-25 15:55 -0400
              Re: How do I terminate a JVM properly? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-25 13:35 -0700
                Re: How do I terminate a JVM properly? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-25 16:58 -0400
                Re: How do I terminate a JVM properly? Arne Vajhøj <arne@vajhoej.dk> - 2016-08-28 13:29 -0400
                Re: How do I terminate a JVM properly? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-28 13:53 -0400
                Re: How do I terminate a JVM properly? Arne Vajhøj <arne@vajhoej.dk> - 2016-08-28 14:14 -0400
        Re: How do I terminate a JVM properly? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-25 05:52 -0700
    Re: How do I terminate a JVM properly? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-24 18:19 -0400
    Re: How do I terminate a JVM properly? Lew <lewbloch@gmail.com> - 2016-08-24 16:12 -0700
    Re: How do I terminate a JVM properly? Roedy Green <inquiry@mindprod.com> - 2016-08-30 16:34 -0700

csiph-web