I am taking the first steps with java, after several extensive experiences with python. script I am running a simple Java Swing Gui that compiles and works fine from the command line and in VS Code.
To set up the java debugging environment, I used the lauch.json settings suggested on the github site https://github.com/k--kato/vscode-javadebug .
Unfortunately, every time I open the folder containing the script, the following error message appears:
Warn: Classpath is incomplete. Only syntax errors will be reported.
I have no idea if the problem arises from the VS code, if it is some other configuration problem, for example, setting up java ....
My working platform is Linux Ubuntu, Gnome Shell.
Can anyone help?
This is the script:
//file name = SimpleEx.java import java.awt.EventQueue; import javax.swing.JFrame; public class SimpleEx extends JFrame { public SimpleEx() { initUI(); } private void initUI() { setTitle("Simple example"); setSize(300, 200); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String[] args) { EventQueue.invokeLater(() -> { SimpleEx ex = new SimpleEx(); ex.setVisible(true); }); } }
and this is my launch.json:
{ "version": "0.2.0", "configurations": [ { "name": "Java", "type": "java", "request": "launch", "stopOnEntry": true, "cwd": "${fileDirname}", "startupClass": "${fileBasename}", "options": [ "-classpath", "${fileDirname}" ] }, { "name": "Java Console App", "type": "java", "request": "launch", "stopOnEntry": true, "cwd": "${fileDirname}", "startupClass": "${fileBasename}", "options": [ "-classpath", "${fileDirname}" ], "externalConsole": true } ] }