Bootstrap FreeKB - Java - Create a simple Java app in Linux on the command line
Java - Create a simple Java app in Linux on the command line

Updated:   |  Java articles

Create a .java file.

touch foo.java

 

Add the following markup to the .java file. Since the name of the file is foo.java in this example the name of the class is also "foo".

public class foo {
   public static void main(String[] args) {
      System.out.println("Hello World");
   }
}

 

Compile the app. This will create a new file named foo.class.

javac foo.java

 

Execute foo and "Hello World" should be displayed.

~]# java foo
Hello World

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 09bce3 in the box below so that we can be sure you are a human.