'exiting' program without stopping jvm

Can anyone please tell me how to exit my standalone java program without stopping the jvm ?!
ie without using System.exit(*). Since I read it stops the jvm also along with the program !
I only want my program with 'main' method in it to stop.
Thanks

The most common way is just to let the main method complete. Here is a simple programimport javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test extends JFrame {
  public Test() {
    JPanel content = (JPanel)getContentPane();
    content.setLayout(new BorderLayout());
    JLabel myLabel = new JLabel("I am a Label");
    myLabel.addMouseListener(new MouseAdapter() {
      public void mouseReleased(MouseEvent me) {
     System.out.println("De Label, De Label");
    content.add(myLabel, BorderLayout.SOUTH);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(300,300);
    setVisible(true);
  public static void main(String[] args) {
    new Test();
}When the line
new Test(); completes, the main method will exit and the event thread will handle exit & mouse clicks. Is this what you mean?

Similar Messages

  • How do I pause a subvi from a mager program without stopping the mager program

    Hello to you all
    I am having a problem and i hope that you can help me, i am traying to make a sub vi to be paused (after it had started to run) at any time that the mager program neads to pause the sub vi. what i mean is that the mager program is running and she activates (runs) the sub vi during her run, and the mager program neads to pause that sub vi at some point ( in order to activate a diffrent sub vi) and let it continue to run only after the diffrent sub vi had finised.
    I didnt found an icon for "pause" like there is for "stop", and the idears that i have are good for pausing the sub vi only at the start of its run and thats it (and thats not what i nead).
    waiting for your replays
    SKI FARM

    Ski Farm,
    I hope you are doing well today! The suggestion provided by altenbach is really good. Alternatively, you can also use a global variable and an event or case structure, to pause the execution of a VI. I have attached an example of a subVI, called by the mainVI, which displays the current iterative count of a while loop. Please let us know if you have any other questions. Have a great day!
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies
    Attachments:
    subVI_false.JPG ‏14 KB
    mainVI.JPG ‏26 KB
    subVI_true.JPG ‏15 KB

  • My safari screen suddenly fills my entire screen, and there is no right hand corner button to push to manually shrink it. What to do? I can never even exit the program without quitting it.

    My screen when I am using Safari suddenly fills my entire screen, and there is no right hand corner button to push to manually shrink it. What to do? I can never even exit the program without quitting it.This has happened only within the last two days.

    Try changing the screen resolution.
    Go to Apple Menu / System Preferences / Displays.
    Change the resolution. Whatever numbers are shown, e.g. 1280 x 960, select a larger one. The larger the number, in the resolution the smaller the display on the screen. You can keep changing this till you find the resolution that suits you.

  • Stopping program without waiting for trigger

    Hi everybody
    I have a problem that I just can't get my head around. I have a program that I use to aquire data. The program goes through the motions of waiting for the trigger, aquiring the data on the appropriate channel, displaying it, and loops back to waiting for the trigger. The problem is That when I want to stop my program while it is waiting for a trigger I must wait for it to recieve a trigger before it will stop excution.
    Is there a way for my program to stop the trigger vi when I select to end the program?
    Thanks
    Beaton
    - there is always an easy way, but it is always the hardest to find

    Hi Beaton,
    you have to split the 'wait for trigger time' into shorter sub-steps.
    Let's say you wait 10sec for trigger signal. Make a loop instead waiting 1 second for 10 times! After each iteration you can check for: 'break the loop (end program)' or 'trigger received' or 'any other error occured'. This way you can stop your program very easily - you can also make your own error state saying 'Error number 123456: stopped by user'...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to use another java program to stop this running prpgram???

    Dear Sir:
    I have following code and I run it success,
    import java.util.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.*;
    public class CertainAndRepeatTime{
      public static void main(String[] args) throws IOException{
        int delay = 1;
        Timer timer = new Timer();
        ActionListener actionListener = new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              System.out.println("Hello World Timer");
        System.out.println("What do you want (Certain time or Repeat time)?");
        System.out.print("Please enter \'C\' or \'R\' for that: ");
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String ans = in.readLine();
        System.out.print("Please enter  ans=" + ans  + " IsTrue=  " + (ans.equals("R") || ans.equals("r")) +"\n");
        if (ans.equals("C") || ans.equals("c")){
          //System.out.println("This line is printed only once start...");
          timer.schedule(new TimerTask(){
            public void run(){
              System.out.println("This line is printed only once.");
          },delay,1);
        else if(ans.equals("r") || ans.equals("R")){
            timer.scheduleAtFixedRate(new TimerTask(){
              public void run(){
                System.out.println("This line is printed repeatedly.");
            },delay, 1000);
          while(true){
               //System.out.println("Charles print This line is printed repeatedly.");          
          } //This will make your main thread hang.
        else{
          System.out.println("Invalid Entry.");
          System.exit(0);
        System.exit(0);
    }But I hope to use another java program to stop it when it is running instead of pressing CRTL + C to stop it.
    How to do it??
    Any example??
    Thanks a lot!!

    Sorry, I think i did not express cearly. It is my fault.
    I re-write my requirements again:
    I have
    Class AAA1.java,
    Class AAA2.java,
    Class AAA3.java,
    Class AAA20.java...
    etc
    they all look like the program I posted first time,, once executed, they will run for ever, and they will be stopped until I press CRTL + C;
    Now I hope to use another java class StopProgram.java to stop them 1 by 1 or at once instead of pressing CRTL + C;
    In this case, how to code this StopProgram.java ??
    Thanks

  • How can I set up a program to stop at a certain time, or after a period of time?

    I am using LabVIEW to measure dc voltages over a period of time. The data is exported into an Excel file.  I would like to be able to set up the program to stop at a certain time, or after a certain number of hours.  This way when I run a test that will start near the end of the week and would stop on say, Saturday, it will not continue to record all the data after that, which I do not need. I would love to be able to set a time for it to end, but I  also wouldn't mind having it end, or stop recording data, after a certain voltage has been reached.

    Its hard to say without knowing more about how your program is set up.  Assuming the data aquisition is in a while loop, you can just wire a bunch of different stop conditions into a compound math node.  Then right click on it and select "OR".  A caveat about the comparisons I used in my little example: Comparing DBLs can lead to unexpected results when the two values are very close together.
    Message Edited by jasonhill on 06-16-2006 10:59 AM
    Attachments:
    stop the loop.PNG ‏5 KB

  • I'm getting the following error message when ever I try to start cs6 and the program gets close. "Adobe Photoshop CS6 has stopped working. A problem caused the program to stop working correctly."

    Hi,
    I’m getting the following error message when ever I try to start cs6 and the program gets close.
    “Adobe Photoshop CS6 has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available”
    Please advise what is the problem? and How to sort this out?
    OS Name
    Microsoft Windows 8.1 Pro
    Version
    6.3.9600 Build 9600
    Other OS Description
    Not Available
    OS Manufacturer
    Microsoft Corporation
    System Name
    JARVIS
    System Manufacturer
    Dell Inc.
    System Model
    Inspiron N5110
    System Type
    x64-based PC
    System SKU
    To be filled by O.E.M.
    Processor
    Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz, 2501 Mhz, 2 Core(s), 4 Logical Processor(s)
    BIOS Version/Date
    Dell Inc. A11, 8/3/2012
    SMBIOS Version
    2.6
    Embedded Controller Version
    1.01
    BIOS Mode
    Legacy
    BaseBoard Manufacturer
    Dell Inc.
    BaseBoard Model
    Not Available
    BaseBoard Name
    Base Board
    Platform Role
    Mobile
    Secure Boot State
    Unsupported
    PCR7 Configuration
    Binding Not Possible
    Windows Directory
    C:\Windows
    System Directory
    C:\Windows\system32
    Boot Device
    \Device\HarddiskVolume2
    Locale
    United States
    Hardware Abstraction Layer
    Version = "6.3.9600.17196"
    User Name
    Jarvis\JARVIS\Abhishek
    Time Zone
    India Standard Time
    Installed Physical Memory (RAM)
    4.00 GB
    Total Physical Memory
    3.16 GB
    Available Physical Memory
    1.21 GB
    Total Virtual Memory
    3.72 GB
    Available Virtual Memory
    1.55 GB
    Page File Space
    576 MB
    Page File
    C:\pagefile.sys
    Hyper-V - VM Monitor Mode Extensions
    Yes
    Hyper-V - Second Level Address Translation Extensions
    Yes
    Hyper-V - Virtualization Enabled in Firmware
    Yes
    Hyper-V - Data Execution Protection
    Yes
    Display adapters:
      and NVIDIA GeForce GT 525M.

    Without the actual crash logs nobody can say, but chances are that your graphics hardware is to blame, so update the driver...
    Mylenium

  • (Solved)pacman , install a program without answer

    Hello world !
    (Firstly , sorry if i make errors in english , it's because i'm french )
    So ! I'm writing a shell program in bash to restore my system (to restore wallpapers , theme, icons, .config ect)
    This is the main file of the program.
    #!/bin/bash
    echo "Bienvenue $USER"
    while [ -z $reponse ] || [ $normal == 1 ]
    do
    let "normal = 0"
    read -p 'Voulez-vous poursuivre la procédure de post-installation ? oui | non : ' reponse
    case $reponse in
    "oui")
    echo "OK"
    #mettre le code ici
    ./themes.sh
    ./icons.sh
    ./applications.sh
    ./config.sh
    ./drivers.sh
    "non")
    echo "À bientôt !"
    echo "erreur syntaxe"
    let "normal = 1"
    esac
    done
    exit
    The main script execute several scripts , and the applications script  install applications (by exemple firefox) but i don't want that pacman asks me an answer to install a program.
    I want know how i can tell at pacman " install the program without my permission , without my answer" but what's the command for this ?
    (Small issue , "i want know" is correct in english ? )
    Thx to read this post
    Last edited by Maximilien Di dio (2014-06-09 15:23:01)

    Maximilien Di dio wrote:
    (Small issue , "i want know" is correct in english ? )
    Thx to read this post
    I want to know, and thanks for reading this post. But don't worry, your English is easily understandable.
    You may also find this useful.

  • Displayed a message box then removed it by a program without user action

    Can a message box be displayed by a program and then removed by the program without any user action such as clicking OK or closing the box?
    If so, will you show us how to do that?
    I have a non-GUI application which needs to tell the user to wait while classes and being created and data is being loaded from the network. The message needs to disappear when the program is ready.
    Thanks!

    Here is an example of using the JDialog you will have to make it look like you want I just pieced this together real quick
    import javax.swing.*;
    public class test extends Object
        public test()
            longOperation();
            System.exit(0);
        public void longOperation()
            JDialog dialog = new JDialog();          
            dialog.getContentPane().add(new JLabel("Wait"),java.awt.BorderLayout.CENTER);
            dialog.setSize(200,200);
            dialog.setVisible(true);
            // used to simulate a long operation
            Thread t = Thread.currentThread();
            try
                t.sleep(2000);
            }catch(Exception e){}
            dialog.dispose();
        public static void main(String args[])
            new test();  
    }

  • Multiple RTMP sources streaming to FMS without stop?

    I have some .mov files want to stream to Flash media server by ffmpeg.
    i have already tried to stream a single .mov by FFMPEG command in terminal and it works, the FMS can display the thing i streaming in live.
    ffmpeg -re -i file1.mov -vcodec libx264 -f flv rtmp://localhost/livepkgr/livestream
    Now i want to stream multiple files as one source, i tried to use above command one by one,
    but it seems Flash media server stop the streaming when file1 is finished, then start the stream with file2.
    It makes the stream player stopped when file1 is finish, and i have to refresh the web page in order to continue on file2.
    i am calling the FFMPEG command by a C program in linux,
    i wonder is there any method that i can prevent the FMS stopped when i switch the file source in FFMPEG?
    or is that possible to let FFMPEG constantly deliver the stream by multiple files source without stopped when a file finish?
    Sorry have for asking a lot recently... but this is urgent to me... thank you

    i am trying to prevent fms pause the publishing the video after publisher stop.
    i tried to comment out all the codes in this 3 method in main.asc 
    application.onUnpublish = function(clientObj, streamObj)
    Client.prototype.FCUnpublish = function( streamname )
    Client.prototype.releaseStream = function(streamname)
    but still when publisher stop, the client side player stop imeediately.
    Also i am can fms receive the stream as soon as possible, and let the video play until the end?
    for example
    i have a video have 5mins length, my publisher software can fast enough deliver the video
    within 30 secs, so that fms should already have 5mins content for broadcasting, can fms
    keep on the broadcasting even the connection from publisher to fms is finish?

  • User Exit Program works Differently

    I'm trying to sync user info from HCM system to a destination system. There is a limitation in SAP HCM system, which allows only full load and not incrememental load or sync up based on events(New Joinee, Position change, Employee Exit) to happen from source to destination. So, I thought User exit could fix this issue.
    When a person inserts or changes or changes the status of an employee to quit through PA30 and saves it, the user exit program should pass the personnel number (numbers) of the user(s) as input to the report RPLDAP_EXTRACT_IDM.
    I am trying to trigger a report(RPLDAP_EXTRACT_IDM) which exports the data from HCM to a destination system(IDM) with the help of a user exit program. Using PA30 when I change the user info and when I save it, through User exit program I'm passing the personnel number of the user(whose data has been changed) as an input to the report, which inturn will replicate the change to the destination.
    Problem:
                User Exit works differently here. After configuring User exit for this tcode(PA30), once I change a user's info and click save, without saving the data, it triggers the User exit program. Usaully while chanign user info, when I click 'SAVE', i get a message 'Recod changed', but now after sonfiguring User Exit program, since the program runs immediately as soon as i click SAVE, I see the following message' Successfully exported Data to the destination' . And the change that i make is not reflected.
    Shouldn't the User Exit program be triggerred after the data is saved?
    Is there a way where I can trigger the User Exit Program after saving the record.

    Not an ABAP expert, but I remember hearing something about PAI and PBO modules and separate user exit includes depending on where you are executing it. Is it worth investigating on these lines?
    Also is it worthwhile configuring Change Pointers to capture whether a change has been made instead of coding user exits in PA30. You could code uxerexits in the ALE data transfer program to analyse the data based on change pointers and transfer data pertaining to New Joinees etc.
    Again I am not ALE epxert, I am just giving my views For what they are worth. For better results perhaps you should post in ABAP forum.

  • A problem caused this program to stop interacting with Windows.  Problem signature:   Problem Event Name:     AppHangB1

    I have received the following error message with Adobe Acrobat Pro XI when working with Portfolio Files. I am operating Windows 7 Professional.
    Has anyone found a fix for this issue?
    Description:
      A problem caused this program to stop interacting with Windows.
    Problem signature:
      Problem Event Name: AppHangB1
      Application Name: Acrobat.exe
      Application Version: 11.0.10.32
      Application Timestamp: 547e97af
      Hang Signature: 8dc7
      Hang Type: 0
      OS Version: 6.1.7601.2.1.0.256.48
      Locale ID: 1033
      Additional Hang Signature 1: 8dc7ed9d7ff41b8cc5ee35b7294b45e9
      Additional Hang Signature 2: e6d0
      Additional Hang Signature 3: e6d001594873a6b1363ccd82616a4edf
      Additional Hang Signature 4: 8dc7
      Additional Hang Signature 5: 8dc7ed9d7ff41b8cc5ee35b7294b45e9
      Additional Hang Signature 6: e6d0
      Additional Hang Signature 7: e6d001594873a6b1363ccd82616a4edf
    Read our privacy statement online:
      http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
    If the online privacy statement is not available, please read our privacy statement offline:
      C:\Windows\system32\en-US\erofflps.txt
    Please help
    John Sorkin [email protected]

    jamodi
    What computer operating system is your Premiere Elements 12 installed?
    How far into the opening of the program do you get? Do you get to the Expert or Quick workspaces?
    And, if so, how long can you stay there? What are you doing when you get this message, opening a new project
    or opening an existing one that has been saved/closed or just trying to launch the program from the desktop icon.
    Are you running the program Run As Administrator and from a User Account with Administrative Privileges?
    Do you have the McAfee antivirus program? Do you have the latest version of QuickTime installed on your computer
    with Premiere Elements 12?
    What video card/graphics card does your computer use? Have you verified at the web site of the manufacturer of the
    card that the video card/graphics card driver is up to date?
    If you do not know, check the Device Manager/Display
    Adapters to determine if you have 1 or 2 cards.
    Depending on your answers, the next step will be
    Uninstall the program the usual Control Panel way.
    (If you can get into the program long enough to go to Help Menu/Sign Out, please do that to deactivate the program
    before going to the uninstall in Control Panel area.)
    Do a run through with ccleaner (both the regular cleaner and registry cleaner parts) to get rid of leftovers from
    incomplete uninstalls and reinstalls.
    https://www.piriform.com/ccleaner
    Reinstall the program with the antivirus and firewalls disabled.
    (If you have McAfee as the antivirus, that may be problem, and we can take care of that without having to go
    through this uninstall/ccleaner/reinstall.)
    Let us start here and then decide what next.
    Thank you.
    ATR

  • Update causing programs to stop responding when loading

    I wasn't sure what forum to put this so i I put it here...
    anyway, I recently updated my OSX with the newest update and now I'm having a ton of problems. My computer seems to be running slower but more importantly several of my programs will stop responding while they're loading up. This includes the two I can't live without: InDesign CS and Microsoft Word. I'm a student in graphic design so these are SUPER important to me.
    I've tried quitting all other programs, or even having my linotype fontexplorer open (it seemed to have worked once but not anymore).
    I really don't know what to do! Is there a way to maybe uninstall updates? because my system was perfectly fine before @_@
    please help!!!

    Hi clemmontine, it was good you were able to isolate the issue to fonts. I don't think the issue is number of fonts but it's possible that one or more of them got corrupted.
    If you have a copy of all the fonts in ~/library/fonts then just drag the fonts in the folder to the trash and drag your backup back in. Restart and retry your apps.
    If not, you need to test the fonts a group at time (if your feeling lucky go for half of them on the first go).
    You can also do this through FontBook.
    -mj
    [email protected]

  • HT4061 I am unable to load Adobe Flash player on my Apple Ipad are there any clues out there how to by pass this,I can not get certain programs without it ,so I am returning my IPAD,any other programs I can load to get my programs

    I am unable to load Adobe Flash player on my Apple Ipad are there any clues out there how to by pass this,I can not get certain programs without it ,so I am returning my IPAD,any other programs I can load to get my programs

    Apple's iOS platform (iPhone, iPad, and iPod Touch) has never, and will never support flash.
    First on this; Thoughts on Flash. This is from Steve Jobs regarding Apple's views on Flash (2010)
    Second; Adobe stops making Flash for mobile devices. This is from Adobe themselves last year stating that they would stop making Flash for mobile devices.
    If you can find the App equivalent of the programs you are looking for, then congratulations, however, if you require specific 'programs' requiring flash, then the iPad is certainly not for you, and returning it would be the best choice (granted you are still within the return period).
    The lesson in this; Research what a device can and cannot do prior to purchase

  • Switching audio sources without stopping FMLE

    We use several Osprey cards, and wish to change from one audio/video source to another audio/video source without stopping FMLE.
    We can do the video switching from one Osprey input to the other using wirecast or vidblaster software video mixers, but are at a loss how to switch the sudio from one osprey input to another without stopping FME and selecting the other audio inpout from the drop-down list. We do not know of any audio mixer that FMLE recognises with which we can accomplish changing one audio source to another withour stopping FMLE.
    Any information in this regard much appreciated,
    Thank you

    to my knowledge, there is no software mixer with 0 lag because its software.  Hardware allows for no lag because theres nothing reading the info, encoding etc.  Software reads the audio data, usually it chunks, this is why it creates lag.  i did some testing using a usb mic and listening for the amount of time between me making the sound and it actually coming out.  Its just barely noticeable to annoy the person talking if he or she were to be listening to it through headphones or speakers, but i would estimate about 1/8 of a second.  Though if you want to be able to remotely control a mixer and you have someone working with you with a little technical experience, you could have them rig up a remote control system using remote control airplane actuators to turn the knobs.
    also while looking mackie control mixers say they have motorized faders, and since its program controlled, i believe you can actually control the faders using a program, but his would mean getting a new mixer.  if you want to look these up, http://www.mackie.com/products/mcupro/

Maybe you are looking for