Reputation: 63
I am using Ubuntu. I have created a package p1 with classes A and B. On desktop, I have created a directory named p1 for this sake.
-------
A.java
-------
package p1;
class A {...}
-------
B.java
-------
package p1;
class B {
A obj = new A();
...
}
Compiling above:
javac A.java ----> creates A.class without any error
javac B.java -----> cannot find symbol A
Am I not compiling it properly?
Upvotes: 0
Views: 109
Reputation: 201447
The command you should use is
javac A.java B.java
I urge you learn about apache ant, apache maven, Scala Build Tool (sbt) and/or gradle if you want to know how to compile more complex software. Ant and maven are very popular, with sbt and gradle being relatively newer (and more "exciting").
Upvotes: 1