Dear All,
I am new to
java and I am facing an issue when compiling a class which is importing a package.
Please find the below steps which I am doing.
Step1:
I created the below addition.java in a folder c:\java
so now I have addition.java in c:\java\addition.java
I also have a folder called pack inside the c:\java folder.
step2: Now compile the addition.java class
javac -d pack addition.java
After compilation when I can see the addition.class in c:\java\pack\subpack\innersubpack\ folder.
Until now it is fine
Step3: Now create a class which is trying to import the addition class
This UseAddition.java is saved in c:\java folder.
Step4:
Now when I am trying to compile the code it is failing
c:\java> javac UseAddition.java
UseAddition.java:1: package subpack.innersubpack does not exist
import subpack.innersubpack.*;
My question is How to compile this UseAddition.java code without moving the code into the c:\java\pack folder and keep it in the c:\java folder itself and compile.
Appreciate your help here.
Thanks&Regards
Madhu K.