0

I have two class file in same folder, both in same package (package hw9;). I can run them in netbeans but when I try to compile in src folder

[user@manjaro hw9]$ javac * 
[user@manjaro hw9]$ java Hw9
Error: Could not find or load main class Hw9

I take this error.

2
  • Is the currect directory in your class path? Look a Java runtime command line options Commented Dec 25, 2015 at 20:07
  • If you are using Linux: pwd helps Commented Dec 25, 2015 at 20:11

1 Answer 1

1

Compile Hw9.java one directory up,

javac hw9/*.java

then run

java hw9.Hw9
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.