-3

I downloaded VS code and tried to run a basic java code in it. I have already installed JDK in my system, set the environment variables too and also downloaded the red hat extension for java. The code runs smoothly in cmd prompt. But when i run the code in VS it says "File not found in the output and "Hello.java is a non project file" .

The same problem is arising in C program too. What should i do to resolve this?

[Image] [1]: https://i.stack.imgur.com/hh8o0.jpg

rioV8
  • 24,506
  • 3
  • 32
  • 49
  • 1
    https://code.visualstudio.com/docs/java/java-tutorial Follow this guide and tell at which step you experience an error and cannot continue. That makes more sense than what you described above, as no one knows what steps you have executed. – Lex Li Dec 20 '20 at 07:14

2 Answers2

0

In some cases, launch.json cwd configuration is causing these errors. Could you please also share launch.json file.

This thread might help too.

Wajid
  • 26
  • 1
  • 1
  • 8
0

File not found in Output.

That's because you're running tempCodeRunnerfile.java but hello.java was opened. Also you use the extension Code Runner, so the result will be shown in Output.

After cleaning java workspace, open tempCodeRunnerfile.java and click the triangle button(Run Code) to try again.

It's recommended that using the integrated Terminal to run the code instead of Code Runner.

Hello.java is a non project file.

This couldn't be called as an error but just a warning. Press Ctrl+Shift+P to open Command Platte and choose Java: Create Java Project. Coding in project, this warning won't be shown.

Gif tutorial and more information please refer to Creating a source code file.

Molly Wang-MSFT
  • 7,943
  • 2
  • 9
  • 22