GUI-less application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Jensen

    #1

    GUI-less application

    Hi

    Here is my problem. I'm currently modifying a program to run without
    the GUI. It shall run on a headless system where X is not installed.
    When I remove the statement that invokes the GUI, the program just
    continues reading statements and exits. The GUI somehow kept the
    application running.

    I have replaced the GUI-statement with

    wait()

    Now everything works. The program runs just fine the way I want it.
    But the problem is that the only way (I know of) to terminate it, is
    to kill it. I would like til to just stop wait()ing and execute the
    last statements in the code.

    How can I send a notify() signal to the program? Can a seperate
    program do this?

    I don't think any source should be nessesary since this is a general
    question, but the code looks like this:

    <code>
    public static void main(String[] args) {
    MainWindow.inst ance().open();
    cleanUpMethod() ;
    System.exit(0);
    }
    </code>
    I changed it to
    <code>
    public static void main(String[] args) {
    wait();
    cleanUpMethod() ;
    System.exit(0);
    }
    </code>
    But cleanUpMethod() and System.exit(0) will never run, 'cause I kill
    it to stop it.


    Thanks
    Martin Jensen
  • Alex Molochnikov

    #2
    Re: GUI-less application

    To keep your GUI-less program running, you have to create a thread, and put
    your wait() in it. Your program will terminate when this thread exits; e.g.
    after receiving a remote message. The GUI accomplished this by creating a
    main event thread that never exited.

    Alex Molochnikov
    Gestalt Corporation



    Comment

    • Stewart Gordon

      #3
      Re: GUI-less application

      Hello. Welcome to newsgroups.

      Newsreaders allow you to address a single message to more than one
      'group simultaneously. This is called crossposting, and is the only
      appropriate method of sharing a message across two or more 'groups.

      Please read


      Meanwhile, since you've multiposted this time, please pick one of the
      'groups that you have multiposted to on which you wish the discussion to
      continue.

      Stewart.

      --
      My e-mail is valid but not my primary mailbox. Please keep replies on
      the 'group where everyone may benefit.

      Comment

      Working...