how to write,compile and run java program on linux

This tutorial is all about how to write compile and run java program in redhat enterprise linux.Here i have mentioned all steps which is essential to run a java program in linux.Before you go through this tutorial let me remind you all that i assume that you have already configured yum server on your redhat enterprise linux machine or you already have idea about how to configure yum server in linux.

If you don’t have idea about how to configure yum server on linux watch this video.

So let’s begin writing compiling and running java on linux.

Step1: install java package using yum

#yum install java*    -y

Step2:Write your java program.Your program name can be anything but extension must be .java.

#vim  helloworld.java

public class helloworld 
{
public static void main(String[] args)
 {
System.out.println("Hello satish how are you?");//display the string
}
}

Save and exit

Step3:Compile your java program using java compiler named javac

#javac helloworld.java

Step5:Run your java program.

#java helloworld

Discover more from Learn Linux CCNA CCNP CEH CISSP CISA Penetration-Testing Bug Bounty IPv6 Cyber-Security Network-Security Online

Subscribe to get the latest posts sent to your email.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.