Building our First Application
First we need to setup our IDE - Whilst Mosh used IntelliJ on his video I decided to setup VS Code.
VS Code Java Extensions
Section titled “VS Code Java Extensions”Extensions Installed Through Marketplace:
Name: JavaId: Oracle.oracle-javaVersion: 23.1.0Publisher: Oracle CorporationVS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=Oracle.oracle-java
Name: Extension Pack for JavaId: vscjava.vscode-java-packVersion: 0.29.0Publisher: MicrosoftVS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack
Starting a new Java Project
Section titled “Starting a new Java Project”You can also create a Java project using the Java: Create Java Project command. Bring up the Command Palette (Ctrl+Shift+P
) and then type java
to search for this command. After selecting the command, you will be prompted for the location and name of the project. You can also choose your build tool from this command.
From here you can add classes
packages
and functions
through the Java Projects
explorer in the bottom right panel of the IDE.
HelloWorld
Section titled “HelloWorld”File Structure
├───.vscode│ settings.json│├───bin│ └───dev│ └───asbedb│ hello.class│├───lib└───src └───dev └───asbedb Hello.java
Hello.java
package dev.asbedb;
public class Hello {
public static void main(String args[]){
System.out.println("Wow my very first packaged function!");
}
}