I am very new to Java programming. Since my original java class contains too many methods, I want to move some of them to another class, so I created a new class MergerHTML.
Before having the second class file, I was using command "javac -cp "./lib/*:lib/*" src/AAA.java"
to compile and using command "java -classpath "lib/*:lib/*" src/AAA.java data/*"
to run the program.
I am already confused here. If I do not put ".java"
in the run command, the message:
"Error: Could not find or load main class src.AAA
Caused by: java.lang.ClassNotFoundException: src.AAA"
would appear. Why is this happening?
After adding the second class file. I used the command "javac -cp "./lib/*:lib/*" src/AAA.java src/MergerHTML.java"
to compile the program, and no error found.
However, when I used command "java -classpath "lib/*:lib/*" src/AAA.java data/*"
, the following is the resulting error:
src/AAA.java:441: error: cannot find symbol
MergerHTML mHTML = new MergerHTML();
^
symbol: class MergerHTML
location: class AAA
My main class file look like below:
public class AAA {
....
public static void main(final String[] args) throws Exception {
MergerHTML mHTML = new MergerHTML();
mHTML.print();
}
}
and helper class file look like below:
public class MergerHTML{
public void print(){
System.out.println("hiiiiii");
}
}