Thursday, February 21, 2013

How To Run Java Programs in Linux OS




How To Run Java Programs in Linux OS

Open the Terminal

Type this Command : Vi filename.java

A window Will open in that 

Create a simple Program 
eg:


import java.io.*;
class HelloWorld
{
   public static void main(String args[])
   {
      System.out.println("Hello World");
   }
}

OutPUT

[amdileeyas@amdileeyas ~]$ vi test.java

[amdileeyas@amdileeyas ~]$ javac test.java

[amdileeyas@amdileeyas ~]$ java test

Hello World

[amdileeyas@amdileeyas ~]$ 


HOW TO COMPILE "JAVA" PROGRAMS IN FEDORA:

STEP 1: Compile your "JAVA" program.
  syntax: $javac sample.java
STEP 2: Find errors and correct the errors. 
STEP 3: Then save and close.


HOW TO RUN "JAVA" PROGRAMS IN FEDORA:

STEP 1Type this command and run your "JAVA" program.
  syntax: $java sample
  output: Hello world
STEP 2: Close the terminal window.
How To Run Java Programs in Linux OS

2 comments:

Linux Tips and tricks,Online Linux Helpers