John John - 4 months ago 70
Java Question

Java console program

I was wondering how to make a Java console program. I use Eclipse as IDE. Looking for something similar to C#'s version of a console program.

Tried Google but only found export to JAR and execute from command line solutions. I would prefer to compile and directly test in a console window.

Thanks in advance

 * put this in a file named

class CommandLineExample
    public static void main ( String [] arguments )
        System.out.println("Hello, world");

type the following from the command line to compile it:

$ javac

then you can run it from the command line like this:

$ java CommandLineExample