I have 3 directories named lib, src and out,
and 2 files, Main.java in the src folder and utils.jar in the lib folder.
To compile the Main.java file I ran the following command:
$ javac -cp lib/utils.jar -d out src/Main.java
But now I can't seem to run it without changing my directory to out and running this command:
$ java -cp ../lib/utils.jar:. Main
As a side note, running
$ java -cp .:../lib/utils.jar Main
gives me:
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
even though it's the same thing no?
Anyway running this command (or similar variations)
$ java -cp lib/utils.jar:out Main
gives me
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
How can I run the Main class without changing the directory to out?