0
public class FirstPrgm
{
    public static void main (String[] args)
    {
        System.out.println("Hello World!!");
    }
}

I have written the above program in vs code.

It shows an option to ( run|debug ) just above the 'public static void main'.

When I click on this 'run' then I see the Hello World!! in the terminal but when I try to run the program with the 'run icon' in the vs code it gives me this error.

    javac : The term 'javac' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:48
+ cd "d:\CODE\JAVA code\Tut Basics\" ; if ($?) { javac FirstPrgm.java } ...
+                                                ~~~~~
    + CategoryInfo          : ObjectNotFound: (javac:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

enter image description here

(try to look at this image if you can I dont know if it will be visible or not)

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
  • Looks like you haven't add the JDK to the PATH. – Shri Hari L Sep 29 '22 at 04:41
  • I did add the path. I don't get why it is running by one way and not by other – Kanak Tanwar Sep 29 '22 at 04:45
  • https://stackoverflow.com/a/8518438/11566161 – Shri Hari L Sep 29 '22 at 04:47
  • 1
    Oh, its done now, after restarting. But i don't get why there are 2 different options to run the code. – Kanak Tanwar Sep 29 '22 at 04:57
  • I would welcome the two different options to run the code. One is only present when you have your main method in view, while the other (the top-right arrow) is always visible. Especially with big projects you don't want to need to return to your main method all the time. On the other hand, a quick run option just above main may come in handy. – Bart Barnard Sep 29 '22 at 12:55

0 Answers0