Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8507873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:59:33+00:00 2026-06-11T02:59:33+00:00

Background Nailgun is a utility (server-protocol-client) for sending java applications to a server with

  • 0

Background

Nailgun is a utility (server-protocol-client) for sending java applications to a server with the purpose of reducing the start up time of the VM.

Problem

A vary basic swing application fails to launch through nailgun. The application exits between the lines marked with “NG 1” and “NG 1.1”, when calling setDefaultCloseOperation. The server prints this:
NGSession 2: 127.0.0.1: org.genja.volumeslider.Aframe exited with status 0
If I comment out the close-operation method of JFrame, the frame shows as it should.

Code

   package org.genja.volumeslider;
   import java.awt.*;
   import java.awt.event.*;
   import javax.swing.*;
   import javax.swing.event.*;
   import javax.imageio.*;
   import java.util.*;
   import java.io.*;

   public class Aframe {
       public static void main(String[] argv) {
           System.out.println("NG 1");
           JFrame frame = new JFrame("VolumeSlider");
           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           System.out.println("NG 1.1");
           frame.setPreferredSize(new Dimension(64,200));
           frame.setResizable(false);

           JSlider  slider = new JSlider(JSlider.VERTICAL, 0, 55, 12);

           frame.add(slider, BorderLayout.CENTER);
           //Display the window.
           frame.pack();
           frame.setVisible(true);
       }
   }

Question

What can be causing this? Is this a bug in nailgun, or should I use some other way of enabling the close button in swing/java? I think it’s relevant to mention that the applications does exit without problems (x button works) even if the class is run through nailgun, without setting the default close operation (perhaps nailgun does this somehow?).

I am fairly confused at this point, and any suggestions would be useful.

update:

It seems also that the keylistener gets KeyEvents that are not properly configured. I’m experiencing that numerical keys still get through when switch-cased with KeyEvent.VK_[0-9], but keys such as VK_ESCAPE and VK_Q do not seem to match. I should probably just look at the “raw” code they generate in that VM and match against that as opposed to the KeyEvent.VK_* constants. Reasonable?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:59:34+00:00Added an answer on June 11, 2026 at 2:59 am

    Nailgun author here.

    Andrew’s instinct is exactly right. Nailgun uses a SecurityManager to prevent one class’s System.exit() from killing the whole Nailgun VM.

    If you set the default close operation to EXIT_ON_CLOSE then closing the window would shut down the VM and prevent future invocations, which I’m guessing you don’t want to prevent.

    A quick check of the openjdk source for JFrame confirms that the System SecurityManager’s checkExit() method is called when you call setDefaultCloseOperation(EXIT_ON_CLOSE). This is where your app is dying. You may also see a com.martiansoftware.nailgun.NGExitException as a result.

    It’s nice that JFrame checks for the exit permission when you set the default close operation rather than when it tries to exit – at least it made this easy to find! 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: I'm running a Minecraft server for friends on a VPS, and I'm attempting
Background I have an installation of VisualSVN on a server. under this, I have
Background: I have several builds running on a Windows Server 2003 R2 machine via
Background I have a calculated value stored in a transient attribute. Every time my
Background: I am getting a Internal Server 500 24 50 error after deploying an
Background: At my company we are developing a bunch applications that are using the
Background: Some time ago, I built a system for recording and categorizing application crashes
Background I work for a large organization which has thousands of MS Access applications
Background I have been asked by a client to create a picture of the
Background Use Ajax to fire an event to the web server when a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.