restart the Java Virtual Machine

Is there a System command that stops the script, and returns it to the first main method, basically restarting the program? If not one command, is there a way to do this at all?Thanks again
[203 byte] By [snoboardera] at [2007-11-27 6:05:32]
# 1

I don't know if there is but you can get around that by writing the code. Somethinf like this:

class Foo {

// other methods

public void run() {

loop {

restart(); // performs initialisation

// other method calls

// when program or game finishes you go around the loop again

// or exit depending upon user choice

}

}

public static void main(String[] args) {

Foo f = new Foo();

f.run();

}

}

floundera at 2007-7-12 16:51:42 > top of Java-index,Java Essentials,New To Java...
# 2

yeah, my problem is that my code just ends in a different class than the original one.

I have a main method call a class, and then a method in that class calls a class . In that class, I have

class Task extends SwingWorker<Void, Void> {

@Override

public Void doInBackground(){

//lots and lots of code.....

}

@Override

public void done() {

JOptionPane.showMessageDialog(null, "There were " + errors + " errors found", "Errors", JOptionPane.ERROR_MESSAGE);

//System.exit(0);

}

}

I think the code just stops where I have System.exit commented out. If I call the first class again, it just puts it over the first one(which never goes away).

I'm having some difficulty w/ it.... although its not the end of the world if the user has to manually restart the program.

snoboardera at 2007-7-12 16:51:42 > top of Java-index,Java Essentials,New To Java...
# 3
If you don't have a System.exit call anywhere, your program will end up back in the first method called by your main. Like the run method in my example. So what ever that first method is, put in some code that allows your program to restart.
floundera at 2007-7-12 16:51:42 > top of Java-index,Java Essentials,New To Java...
# 4
aaaannnnnndddd I just found a workaround,so nevermind...Another part of my code was making it stop. I was confused as to why it was doing that all by itself.....
snoboardera at 2007-7-12 16:51:42 > top of Java-index,Java Essentials,New To Java...