Problem with JDK. Compiling

已回答

Hello I am new to programming. I watched video for java programing. I write 

package com.amigoscode;

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

Then I run and open therminal. Typed cd src/
then c:users\myuser\Idearprojects\projects\src javac com/amigoscode/Main.java

I have 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:1                       
+ javac com.amigoscode/Main.java
+ ~~~~~
   + CategoryInfo          : ObjectNotFound: (javac:String) [], CommandNotFoundException
   + FullyQualifiedErrorId : CommandNotFoundException

I have JDK in installed. But when I type in powershell javac -version nothing shows up. 


 

1
Hello,

You must first config javac in system properties, please follow this guide: https://www.geeksforgeeks.org/how-to-set-java-path-in-windows-and-linux/
0

请先登录再写评论。