Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot debug a single file when no workspace folder is opened #832

Closed
VivekHalakatti opened this issue Nov 29, 2021 · 18 comments
Closed

Cannot debug a single file when no workspace folder is opened #832

VivekHalakatti opened this issue Nov 29, 2021 · 18 comments
Assignees

Comments

@VivekHalakatti
Copy link

VivekHalakatti commented Nov 29, 2021

Environment:Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)

  • VS Code Version:1.62.3
  • Extension Version:
  • JDK Type & Version: java 17.0.1 2021-10-19 LTS
    Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
    Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
  • OS Type & Version: MacOS & Monterey
    Step to Reproduce:I have installed JDK correctly and all files are in the right directory. But i am unable to run any java programs using text editors such as VS code, sublime.They do not show any error either! just blank space.i have tried multiple text editors with java code and none are working. But the same works when done in terminal explicitly

Expected Behavior:They have too run atleast simple programs other than printing strings.I am unable to do anything
other than printing strings.Incapable to show the outputs of the performed computations

Actual Behavior:No output of computations other than string.

Related Issues: <!-- Not just with visual code , happens with sublime too.

Screenshot 2021-11-30 at 12 33 44 AM

-->
@Eskibear
Copy link
Member

Have you installed Java Extension Pack including the debugger extension? Please follow this: https://code.visualstudio.com/docs/java/java-tutorial#_running-and-debugging-your-program

Let me know if it works.

BTW, it's running, awaiting for user input. Looks like you are running Java program from other extension (like CodeRunner).

@VivekHalakatti
Copy link
Author

Have you installed Java Extension Pack including the debugger extension? Please follow this: https://code.visualstudio.com/docs/java/java-tutorial#_running-and-debugging-your-program

Let me know if it works.

BTW, it's running, awaiting for user input. Looks like you are running Java program from other extension (like CodeRunner).

Thank you for your early response😄. Yes i have installed all the needed extensions, i still am facing the same problem.

@testforstephen
Copy link
Contributor

You're using Code Runner to run your Java code, that's not contributed by vscode-java-pack. Could you pls try "Run Java"/"Debug Java" button?

image

@VivekHalakatti
Copy link
Author

You're using Code Runner to run your Java code, that's not contributed by vscode-java-pack. Could you pls try "Run Java"/"Debug Java" button?

image

Yes, i have tried that too. Nothing happens when i click on "Run java".

@VivekHalakatti
Copy link
Author

You're using Code Runner to run your Java code, that's not contributed by vscode-java-pack. Could you pls try "Run Java"/"Debug Java" button?
image

Yes, i have tried that too. Nothing happens when i click on "Run java".

Could you please connect to me via teamviewer or any other screen sharing app and get me through this?

@testforstephen
Copy link
Contributor

We launch your application in TERMINAL view, could you check your TERMINAL view?

@VivekHalakatti
Copy link
Author

Java program execution is proper when done directly through terminal but when executing the same using visual studio ,it is not working properly. For example, in the image below it is not accepting any input in Visual studio. But in terminal(second image) everything works fine
VS
.
Screenshot 2021-12-01 at 1 36 24 PM

@testforstephen
Copy link
Contributor

Screen.Recording.2021-12-01.at.16.31.09.mov

@Eskibear
Copy link
Member

Eskibear commented Dec 1, 2021

@VivekHalakatti You were using another approach (probably provided by other extensions) to run your project, NOT provided by our extensions.

@VivekHalakatti
Copy link
Author

Screen.Recording.2021-12-01.at.16.31.09.mov

VSProblem.mov

@Eskibear
Copy link
Member

Eskibear commented Dec 1, 2021

Note: If you open a Java file in VS Code without opening its folder, the Java Language Server might not work properly.

Please open a folder containing this file. Otherwise it's working in lightweight mode (indicated by the rocket icon in bottom right corner).

@Eskibear
Copy link
Member

Eskibear commented Dec 1, 2021

@testforstephen I can simply reproduce it by dragging in a .java file without opening any folder.

  • Run Java: silent failure
  • Debug Java: silent failure
  • F5: silent failure with a debugging toolbar.

We should probably optimize debugger extension for such case. Beginners might get stuck on this due to silent failure.

@VivekHalakatti
Copy link
Author

Note: If you open a Java file in VS Code without opening its folder, the Java Language Server might not work properly.

Please open a folder containing this file. Otherwise it's working in lightweight mode (indicated by the rocket icon in bottom right corner).

Wow,thanks a lot!!. It is working now. I feel so stupid tbh�
Screenshot 2021-12-01 at 2 34 04 PM
�.

@VivekHalakatti
Copy link
Author

But ,why is coderunner extension stuck without taking any input?
Screenshot 2021-12-01 at 2 38 44 PM

@Eskibear
Copy link
Member

Eskibear commented Dec 1, 2021

But ,why is coderunner extension stuck without taking any input?

Basically it's using output channel, which doesn't have the capability to interact with user. You'd better ask author of code runner about it.

@testforstephen
Copy link
Contributor

There is a regression bug about single file debugging support. redhat-developer/vscode-java#2231

If you opened a single file without a workspace folder, the debugger extension will be broken. The upstream Java language support for Java extension has fixed it and will be released in 1.2.0.

@testforstephen testforstephen changed the title Bug Cannot debug a single file when no workspace folder is opened Dec 1, 2021
@VivekHalakatti
Copy link
Author

Thank you so much @Eskibear @testforstephen

@testforstephen
Copy link
Contributor

Closing it since Java Language Support extension @1.2.0 version has fixed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants