Hey everybody,
I haven't tried vscode for java before, but I was wondering what others think of using it for an IDE?
I have used eclipse and intellij before, but was considering vscode. If you have tried it, what packages have you found useful, what are the things you like and what are your pain points using it?
I am going to experiment with it tomorrow and make a workspace in vscode for it.
Cheers!
Is it possible to program with Java using Microsoft Studio Community 2019?
compilation - How to compile and run Java code in Visual Studio Code - Stack Overflow
Java in VScode. No "Referenced Libraries" folder. Cant add jars.
Are you using a build tool like Maven or Gradle? Referenced Libraries is for projects without a build system where you need to add libraries manually.
If you're using Maven or Gradle, you'd declare the libraries in your pom.xml or build.gradle (which the Java extension will automatically pick up on).
No Syntax Highlighting for Java
Videos
As a first step, try to compile your programm from te command line. E.g. How do I run a Java program from the command line on Windows? is a good start. You can run the commands directly in VSCode's integrated terminal. Optionally, create a VS Code build task from that command to run builds with the build command.
{
"version": "2.0.0",
"tasks": [
{
"label": "Build Foo",
"type": "shell",
"command": "javac foo.java",
"problemMatcher": []
}
]
}
To run/debug, create a launch config in the debug viewlet, for example:
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug (Launch)-Foo",
"request": "launch",
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopOnEntry": false,
"mainClass": "Foo",
"args": ""
},
{
"type": "java",
"name": "Debug (Attach)",
"request": "attach",
"hostName": "localhost",
"port": 0
}
]
}
If you are using Maven, you should see a MAVEN tab at the bottom of the left menu bar. Clicking on it will expand to show your project name. Right click on it shows a "Run Maven Commands" option, under which you will see Compile and other stuffs like run and debug.