vscode-java-debug
vscode-java-debug copied to clipboard
cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..
I cannot evaluate an expression in VSCode debugging tomcat.
I have this error. cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..
My launch.json
{ // 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) - Current File", "projectName": "My API", "request": "launch", "mainClass": "${file}" } ] }
Environment
- Operating System: Windows 10
- JDK version: 11
- Visual Studio Code version: 1.46.1
- Java extension version: v0.9.1
- Java Debugger extension version: v0.26.0
Is there anything else that i should change in my launch.json?
I cannot evaluate an expression in VSCode debugging tomcat.
Could you share your steps to launch the tomcat and connect to the debugger?
I cannot evaluate an expression in VSCode debugging tomcat.
Could you share your steps to launch the tomcat and connect to the debugger?
Tomcat: Start Tomcat Server Tomcat: Debug on tomcat server: And i choose my war file
OK, you're using Tomcat for Java extension to launch debugging. That extension doesn't consume the local launch.json config. Could you take a look at a new extension https://marketplace.visualstudio.com/items?itemName=redhat.vscode-server-connector, it has better support for tomcat server.
Where should it be the launch.json?
The extension that you mention it's not for tomcat, at least it doesn't name it on the supporte list of servers.
Sorry, i read that is supported, at least minimal requriements. I will check, thanks.
This issue has been closed automatically because it needs more information and has not had recent activity. Please reach out if you have or find the answers we need so that we can investigate further.
How can i help to get this fix? I add as many information as i could. Could it be a test case? Is easy to reproduce it.
If you want the case is covered well, at least you should provide detailed reproduce steps and a minimum sample project to reproduce the issue.
I have same issue and can create a test case.
servlet URL GET: http://127.0.0.1:8080/WSJson/test
when VScode open the folder with two projects it can not evaluate any thing. If I only start VScode with one project it will work as usual.
I need to debug something in the dependency project so I hope this can be fixed.
Had a similar problem. In my case the solution was to use exactly the same project name as in the file .project. Then it did work.
Hi:
For any newcomers experiencing this issue, an above comment suggests using vscode-server-connector
extension instead of the tomcat extension. The actual name of the extension is vscode-community-server-connector
.
https://marketplace.visualstudio.com/items?itemName=redhat.vscode-community-server-connector
The other extension (vscode-server-connector
) has support for Red Hat servers and runtimes, NOT Tomcat. Please use the community extension instead.
@robstryker The community extension works with tomcat as you point out, but I still have the same issue as OP.
We've had one user report a similar issue here: https://github.com/redhat-developer/rsp-server-community/issues/85
No real solution was found but some of the comments from the user provide a workaround.
Right-click on a Java file (one without a main()
function) and choose "Run Java" and you'll get a prompt with a few options. This prompt will show the project name.
As you can see in this screenshot of this Ant project, sometimes the project name is unpredictable.
See also this answer on StackOverflow
in my case I ended up using Eclipse for debugging. VS code java debugging sucks