0% found this document useful (0 votes)
29 views2 pages

Java Compiler Eclipse Practical

The document outlines the steps to write, compile, and execute a simple Java program using both the Java compiler via command line and the Eclipse IDE. It provides detailed instructions for creating a 'HelloWorld' program, compiling it, and running it in both environments. The conclusion confirms successful execution of the program in both methods.

Uploaded by

munasif018
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Java Compiler Eclipse Practical

The document outlines the steps to write, compile, and execute a simple Java program using both the Java compiler via command line and the Eclipse IDE. It provides detailed instructions for creating a 'HelloWorld' program, compiling it, and running it in both environments. The conclusion confirms successful execution of the program in both methods.

Uploaded by

munasif018
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Practical: Use Java Compiler and Eclipse Platform to Write and Execute a Java Program

Objective:

To write, compile, and execute a simple Java program using the Java compiler and Eclipse IDE.

Tools Required:

- JDK (Java Development Kit)

- Eclipse IDE

1. Using Java Compiler (Command Line):

Open a text editor (Notepad/VS Code) and write the following Java program:

// HelloWorld.java

public class HelloWorld {

public static void main(String[] args) {

System.out.println("Hello, World!");

Save the file as HelloWorld.java.

Open Command Prompt (cmd) and navigate to the folder where the file is saved.

Compile the program using: javac HelloWorld.java

If no error occurs, it will generate HelloWorld.class.

Run the program using: java HelloWorld

Output: Hello, World!

2. Using Eclipse IDE:

Open Eclipse.

Go to File > New > Java Project.

- Project Name: MyFirstJavaProject

- Click Finish.
Right-click on the src folder -> New > Class.

- Name: HelloWorld

- Check 'public static void main(String[] args)'

- Click Finish

In the editor, write the following code:

public class HelloWorld {

public static void main(String[] args) {

System.out.println("Hello, World!");

Click the green 'Run' button (Run) on the top toolbar.

Output in Eclipse Console: Hello, World!

Conclusion:

Successfully created, compiled, and executed a Java program using both the Java compiler (CLI)

and Eclipse IDE.

You might also like