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