Wednesday, April 29, 2020

Getting Started with Java in VSCode IDE


I started picking up Java recently. Here are the steps to get started with a sample project (say, the usual "Hello World !!") in Java.



1) Install Java JDK for Mac: I think it was already installed earlier. So, didn't have to do this step in my case.


2) Install VSCode: https://code.visualstudio.com/download. A friend of mine suggested to use VSCode, so I'm going to give it a try.


3) Install. Move VSCode to Applications folder. This created an icon like this in Mac's Launchpad:


                                                              









4) Create a new workspace in VSCode by choosing "Add Workspace Folder". 





I created and named my workspace folder "HelloWorld". 





5) I then created a file named "HelloWorld.java" and filled in a few lines of code (some of it getting auto-filled). After I completed typing public static void main method's prototype, I got "Run | Debug" appear on top of it automatically.


When I clicked "Run", the program output "Hello World !!" on the console pane.






Hope this helps.



UA-48797665-1