I set all the paths correctly through 'environment variables' and my code is fine. It does compile my file, but it cannot run it. I'm a mathematician and normally run java files at uni, but this time I downloaded jdk on my window computer to work from home. Please could anyone help me?
paths in environment variable C:\Program Files\Java\jdk1.8.0_231\bin
CLASSPATH in environment variable C:\Program Files\Java\jdk1.8.0_231\lib
Both java and javac versions look fine.
PS C:\Users\Administrator\Desktop\Algo> java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
PS C:\Users\Administrator\Desktop\Algo> javac -version
javac 1.8.0_231
PS C:\Users\Administrator\Desktop\Algo> javac HowAreYou.java
PS C:\Users\Administrator\Desktop\Algo> java HowAreYou
Error: Could not find or load main class HowAreYou
The following is my java code:
class HowAreYou {
public static void main (String[] args) {
System.out.print("Hello ");
System.out.print(args[0]);
System.out.println(", how are you today?");
}
}