I am making an app similar to the CMD in windows, or Terminal in Linux. My problem is, after calling the method the user has selected, I want them to be able to select another. Instead, it closes.

Main class (jDOS.class)

package jdos;
/**
 *jDOS Cross-Platform Java Console
 *Luke Pattinson 2011
 */
public class JDOS {

    public static void main(String[] args) {
        System.out.println("\n\n\njDos Cross-Platform Java Console\nLuke Pattinson 2011");
        comInput commI = new comInput();
        String comm = commI.getComm();
        
        if (comm.equals ("quit")) {
            System.exit(0);
        } 
        if (comm.equals ("internet")) {
            deskFunc browse = new deskFunc();
            browse.browse();
        }
        if (comm.equals ("help")) {
            System.out.println("quit - exits the system (does not exit the console)\nhelp - displays this message\ninternet - navigates to a webpage");
        }
    }
}

Can anyone help me?
:confused:

-EDIT-
Solved, sorry :3

Recommended Answers

All 3 Replies

after calling the method the user has selected, I want them to be able to select another

Wrap the code in a while or do while loop that requires input from the user to exit.

Wrap the code in a while or do while loop that requires input from the user to exit.

thought of posting this as well, but he already stated that he solved it.

@OP: a better way to let the community know that your problem is solved, is to mark the thread as solved.
also, you could post how you solved it, so that people can refer to your solution when someone else is facing the same problem.

thought of posting this as well, but he already stated that he solved it.

@OP: a better way to let the community know that your problem is solved, is to mark the thread as solved.
also, you could post how you solved it, so that people can refer to your solution when someone else is facing the same problem.

On what stultuske said, i commend you for solving this by yourself, but also please to all those that solve it themselves, post your solved code, so that the next person to google the problem you had might pick up your thread and find your answer after all thats what daniweb is about.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.