简体   繁体   中英

How to open your eclipse project in a window?

How do I export my Eclipse project so that it is its own console application sort of thing.

Every time I try to run the .jar file after exporting it, a window pops up saying that it couldn't open the program. Is there some code I need to enter in order to make it its own window, like when you run it in eclipse, except it is its own window and application. Here is an example of how I have coded it:

public class main {
    public static void main(String[] args) {
        Scanner text = new Scanner(System. in );
        System.out.println("Ready:");
        boolean loop2 = true;

        while (loop2 = true) {
            String text1 = text.nextLine();

            switch (text1) {

                case "hi":
                    System.out.println("Greetings!");
                    break;
            }
        }
    }
}

Any help would be nice! I am trying to make this for sending to my friends, too, just so you know.

In the navigator view, right-click on your project > Export > Java > Jar. Be sure to indicate your class as main class.

Then, once saved, you can run the jar by double clicking on it, or using java -jar jarfile.jar from command line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM