I have depended on using IDEs all the time for Java and would like to use the terminal to understand more.
I have a Java application called test.java. It depends on other jar files to compile and run.
The first line of my application also creates a package as follows
package package1;
Now, when I compile this with :
javac -cp .:"JAR FILE PATHS HERE" test.java
It compiles fine. However when I try to execute it as follows:
java -cp .:"JAR FILE PATHS HERE" test
I get the error Error: Could not find or load main class test
If I don't create a package in my application with package package1;
, it executes fine.
How do I execute it if I do create package1 tho? using path package1/test doesn't work