Open Estebjor opened 6 years ago
use "externalConsole": true in your launch.json
On Fri, Aug 25, 2017 at 1:40 AM, Estebjor notifications@github.com wrote:
I want to use a number from the keyboard, how can i configure VSCODE. ? ` import java.util.Scanner;
class Acceptinput{
public static void main (String[] args){ int a; Scanner s = new Scanner (System.in); System.out.println("Enter your lucky number"); a = s.nextInt(); System.out.println("Your lucky number is: " +a); }
} `
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DonJayamanne/javaVSCode/issues/67, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7NxwRO-n0QhADxA_tO0fdUpbXD434Pks5sbmxXgaJpZM4PCR8b .
Actually it is true `{ "version": "0.2.0", "configurations": [
{
"name": "Java",
"type": "java",
"request": "launch",
"stopOnEntry": true,
"jdkPath": "${env:JAVA_HOME}/bin",
"cwd": "${fileDirname}",
"startupClass": "${fileBasenameNoExtension}",
"classpath": [
".",
"${fileDirname}"
]
},
{
"name": "Java Console App",
"type": "java",
"request": "launch",
"stopOnEntry": true,
"jdkPath": "${env:JAVA_HOME}/bin",
"cwd": "${fileDirname}",
"startupClass": "${fileBasenameNoExtension}",
"classpath": [
".",
"${fileDirname}"
],
"externalConsole": true
}
]
}`
Then, be sure that "Java Console App" is checked in debug menu before click the green play button. :-)
On Fri, Aug 25, 2017 at 10:01 AM, Estebjor notifications@github.com wrote:
Actually it is true `{ "version": "0.2.0", "configurations": [
{ "name": "Java", "type": "java", "request": "launch", "stopOnEntry": true, "jdkPath": "${env:JAVA_HOME}/bin", "cwd": "${fileDirname}", "startupClass": "${fileBasenameNoExtension}", "classpath": [ ".", "${fileDirname}" ] }, { "name": "Java Console App", "type": "java", "request": "launch", "stopOnEntry": true, "jdkPath": "${env:JAVA_HOME}/bin", "cwd": "${fileDirname}", "startupClass": "${fileBasenameNoExtension}", "classpath": [ ".", "${fileDirname}" ], "externalConsole": true }
]
}`
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/DonJayamanne/javaVSCode/issues/67#issuecomment-324946774, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7Nx0y7IhjBPkkEjcJKrcSev9eJaPuvks5sbuHigaJpZM4PCR8b .
It shows me: Failed to start the program, Timeout after 5000 milli-seconds
Ok, I need more information about your environment, What is your Operative System?
On Fri, Aug 25, 2017 at 1:29 PM, Estebjor notifications@github.com wrote:
It show me: Failed to start the program, Timeout after 5000 milli-seconds
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/DonJayamanne/javaVSCode/issues/67#issuecomment-325002700, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7Nx8F9-WAjhyQY1AQmt16Pw4jEh2euks5sbxKlgaJpZM4PCR8b .
I'm using win10.
Seems you have some different configuration in your machine.
I also have Windows 10, and this extension works well: (I used your code as example)
it is a bug that we can't use internal terminal for user input while in debug mode. for Python/C# internal terminal is working fine while debugging. I guess the issue is more on the VS code side but not sure.
This was the original issue :sweat_smile:
I don't think that this is a VS Code issue.
The only question is: does the Java debugger support to communicate over a separate communication channel so that stdin/stdout if freely available to the Java program. If the debugger itself uses stdin/stdout to communicate with the user, the Java program cannot read from stdin at the same time.
I was a bit confused, My bad :sweat_smile:
@weinand Thanks for keep discussion here :+1:
I added this issue to Known issues in README for now.
Also I added a tiny Contributing guide if someone want to help to fix this.
I want to use a number from the keyboard, how can i configure VSCODE. ? ` import java.util.Scanner;
class Acceptinput{
} `