no

Writing Your First Hello World in Java

Go Back to Course Outline I. Installing Java Development Kit (JDK) Download the Java Development Kit (JDK) from https://developers.r...

Go Back to Course Outline

I. Installing Java Development Kit (JDK)

  1. Download the Java Development Kit (JDK) from https://developers.redhat.com/products/openjdk/download. Select Java 8 as it is still the most widely supported version available. X64 (right-click on My Computer or This Computer and select properties) and MSI installer if applicable.
  2. I normally install JDK on c:\Java\Jdk\ folder.
    1. https://en.wikipedia.org/wiki/Java_version_history
  3. Add Java into your user environment path.
  4. Make sure that there is no other entry of Java path in both your user and system path.
  5. Start a terminal and see if java and javac commands are running.

II. Set Java in User’s Environment Path

  1. Right-click on My Computer or This Computer.
  2. Click Advanced system settings.
  3. Click the Advanced tab.
  4. Click Environment Variable.
  5. You should arrive at the screenshot below.
  6. Create a new entry "JAVA_HOME" and set the path where you installed the JDK.

III. Downloading and Installing Eclipse

  1. Download eclipse from https://www.eclipse.org/downloads/
  2. Configure the installed JRE inside eclipse.

IV. Creating our First Hello World Project

  1. Inside eclipse select File / New / Java Project.
  2. In the Project name field enter Hello World.
  3. Select 1.8 in Use a project specific JRE.
  4. Click Finish.

V. Creating our First Hello World Project in Maven

  1. Inside eclipse select File / New / Other.
  2. In the select a wizard panel, Wizards filter, enter maven.
  3. Under the maven folder, select Maven Project. Click next.
  4. Click “Use default workspace location” or uncheck it to select a folder where you want the project to be created.
  5. You can also create and select a working set. Click next.
  6. In the new maven project panel, catalog selection, select Maven Central.
  7. Select the row with Group Id=org.apache.maven.archetypes, Artifact Id=maven-archetype-quickstart. Click next.
  8. Enter the following details:
    1. Group Id=com.broodcamp
    2. Artifact Id=hello-world2
    3. Package=com.czetsuya.hello
    4. Click finish.

VI. Compiling, Running and Debugging

  1. Run the application using the menu.
    1. Run / Run
    2. In the Run As a panel, select Java Application
    3. Select App, which is a class in our project
  2. Run the application using the project’s context menu.
    1. Right-click on the project
    2. Select Run As
    3. Select Java Application
    4. Select App, which is a class in our project
  3. Debug by selecting Run / Debug As / Java Application.

Related

java-getting-started 7185406130752489134

Post a Comment Default Comments

item