Visual Studio Code Installation - RobotGirls/FTC-Team-25 GitHub Wiki

Download Visual Studio

  • Reference: How to set up Java in Visual Studio Code
  • Visual Studio Download
    • image
  • To set Color theme
    • Code->Preferences->Theme->Color Scheme
  • Next get a terminal window
    • Windows:
      • Type CMD on the search bar at the bottom left corner
    • Mac: Click on terminal icon
  • In terminal window type "java --version" and/or "java -version"
    • If it indicates 'java' is not recognized as an internal or externa command, then
      • Documentation for Visual Studios
      • Click on the JAVA link on the left side of the Documentation for Visual Studios web page, which will expand to a list of options and select the "Getting Started" option. OR go directly to Getting Started with Java in VS Code
      • Go to the "Setting up VS Code for Java Development"
      • Once it has completed the download, then click on the install and accept the License Agreement
        • The coding pack includes the jdk (Java Development Kit), the visual studio code, and the Java extension for visual studio code.
        • Go to the terminal window and try 'java --version' again to make sure that java is found
  • Bring up VS Code

Start VS Code Development

  • Reference: https://code.visualstudio.com/docs/java/java-tutorial

  • Reference: Java in VS Code (Getting Started)

  • Click on "Explorer" on the left panel which looks like two overlapping rectangles where the top rectangle has a folded edge

    • Then click on the "Open Folder" blue button and navigate to ~/Desktop/FIRST
    • Make a new folder in ~/Desktop/FIRST/java_vscode_files and put your new file in this folder
  • Create a new file

    • On the "Welcome" tab, select "New File..."
    • OR File->New File...
  • Remember, the filename has to be suffixed with ".java". (e.g., Hello.java) and has to be the same name as your class!!!

  • The following window pops up image

    • If you get this message "'boolean org.eclipse.jdt.internal.core.SourceMethod.isMainMethodCandidate()'", install a new version of the java debugger
      • Reference: Change your Java Versions in VS Code
        • Bring up "Configure Java Runtime"
        • Bring up the command prompt
          • ctrl-shift-P for windows
          • cmd-shift-P for mac
        • Scroll down and hit the blue Download button.
      • To update the Java Version, which causes the above issue, you can follow the video above or more simply follow the directions below:
        • Click on the Extensions on the left panel which is an icon that looks like a few boxes (above the icon that looks like a flask)
          • image
        • Then click on the "Reload Required" blue button
          • image

Configure Java Runtime

  • Reference Java in Visual Studio Code (Getting Started)

  • Bring up "Java Getting Started"

    • Bring up the command prompt
      • ctrl-shift-P for windows
      • cmd-shift-P for mac
    • In the command prompt type: "Java: Java Getting Started"
    • Then click on "Java Getting Started" tab
    • Run->Add Configuration, which shows the following: image
    • Once you've added a configuration, it should show up in your Explorer panel as "launch.json"
    • In the future, to view it, click on launch.json or Run->Open Configuration
  • Now hit the "Play" icon (looks like a triangle) on the upper right hand corner and it should compile and run your program