How to create a simple Java app in Linux

Home > Search > How-to
  by

Create a file named myJavaApp.java.

~]# touch myJavaApp.java

 

Add the following markup to myJavaApp.java.

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

 

Compile myJavaApp. This will create a new file named myJavaApp.class.

~]# javac myJavaApp.java

 

Execute myJavaApp, and "Hello World" should be displayed.

~]# java myJavaApp
Hello World

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments