vscode-java-debug icon indicating copy to clipboard operation
vscode-java-debug copied to clipboard

java terminal promot error

Open Mon-ius opened this issue 6 years ago • 4 comments

Every time I run the java from vscode "Run| Debug" button.

it will give

prompt_ip:8: command not found: networksetup prompt_load:29: command not found: sysctl prompt_load:31: command not found: sysctl prompt_load:44: bad math expression: operand expected at * 0.7' ` following the result.

It looks that it will run the /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/9m/wk4wyf8n6_s6fhryl541tp9w0000gn/T/cp_7casio0lyeeq4l687bbee3z8n.argfile

which cause the problem.

Does anyone ever meet the same problem as me?

Additionally, I have created two issues.

See https://github.com/microsoft/vscode/issues/84287 and https://github.com/redhat-developer/vscode-java/issues/1136.

Mon-ius avatar Nov 25 '19 00:11 Mon-ius

Which terminal are you using? Could you change the VS Code user setting java.debug.settings.console to internalConsole and try again?

testforstephen avatar Nov 25 '19 01:11 testforstephen

I used the iterm2 with zsh as my system terminal. Under VScode I use intergratedTerminal when meeting the issue. Change it to internalConsole doest make sense.

The strange thing is I didn't get any error when I open the iterm2. And there is no error when I set it as externalTerminal.

Mon-ius avatar Nov 25 '19 15:11 Mon-ius

This is not java-specific as I've just started experiencing the same issue with Python. Also with zsh here. I tried setting terminal.explorerKind to external but it didn't help.

After trying various things I realized I had a line "terminal.integrated.inheritEnv": false in my user settings => I switched it to true and now the problem is gone.

odelalleau avatar Jan 17 '20 18:01 odelalleau

Hi @Mon-ius, I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

Suggestions to work around zsh prompt errors when launching Java in VS Code:

• Use the internal debug console (no shell prompt): in your launch.json add or edit:

"console": "internalConsole"

• Launch an interactive login shell so your prompt functions are defined: in your VS Code settings.json add:

"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.shellArgs.osx": ["-l"]

• Guard your prompt code so it only runs in interactive shells. Wrap it in your ~/.zshrc or ~/.zshenv:

if [[ -o interactive ]]; then
  source /path/to/prompt_ip
fi

Duplicate issues:

• redhat-developer/vscode-java#1136: same “prompt_ip:8: command not found” error when using the Run/Debug button
https://github.com/redhat-developer/vscode-java/issues/1136

Other references with low confidence

• microsoft/vscode#84287: zsh prompt errors in integrated terminal (“networksetup” not found)
https://github.com/microsoft/vscode/issues/84287

The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

github-actions[bot] avatar Nov 11 '25 12:11 github-actions[bot]