Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug/run standard java in Visual Studio Code IDE and OS X?

Love the light-weight Visual Studio Code in OS X. Have always wanted the ability to write, debug and run standard java (NOT javascript) from VSC in OS X. Found the following extension which allows you to debug and run java from VSC:

https://marketplace.visualstudio.com/items?itemName=donjayamanne.javadebugger

Followed the directions as best as I could. Trying to run my java app, and I am getting a bunch of "error: cannot find symbol" errors in the debug-console window when I run my java app in VSC from OS X. App runs great in eclipse. What am I missing in either VSC or somewhere in OS X so I can properly run java code from VSC in OS X?

like image 839
Greymarch Avatar asked Sep 19 '16 21:09

Greymarch


People also ask

Can you Debug Java in VS Code?

Visual Studio Code allows you to debug Java applications through the Debugger for Java extension. It's a lightweight Java debugger based on Java Debug Server, which extends the Language Support for Java™ by Red Hat. Here's a list of supported debugging features: Launch/Attach.

How do I add Java debugger to Visual Studio Code?

In Visual Studio Code, open the Extensions view (Ctrl+Shift+X). Type "java" to filter the list. Find and install the Extension Pack for Java or standalone Debugger for Java extension if you already have Language Support for Java™ by Red Hat installed.

How do you run code in VS Code Mac?

Launching from the command line# You can also run VS Code from the terminal by typing 'code' after adding it to the path: Launch VS Code. Open the Command Palette (Cmd+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.


1 Answers

There is a much easier way to run Java, no configuration needed:

  1. Install the Code Runner Extension
  2. Open your Java code file in Text Editor, then use shortcut Ctrl+Alt+N, or press F1 and then select/type Run Code, or right click the Text Editor and then click Run Code in context menu, the code will be compiled and run, and the output will be shown in the Output Window.

runJave

like image 94
Jun Han Avatar answered Sep 22 '22 03:09

Jun Han