Hello I have a question in Java when compiling with packages. Can anyone Help??
My 2 java files BeerSelect2.java & BeerExpert.java are in packages com.example.web & com.example.model respectively. The root folders goes like this.
C:\MyProjects\beerV1\src\com\example\web\BeerSelect2.java
and
C:\MyProjects\beerV1\src\com\example\model\BeerExpert.java
I have compiled the BeerExpert.java in the model package.(ie the class file for BeerExpert is in the com.example.model package.)
My BeerSelect2 file which is inside the web folder is like this
This shows 3 comile errors.
& the BeerExpert.java file which is in the model folder is like this:
This compiles fine in the model folder.
Now in the above BeerSelect2.java program(Servlet)-- when I'm trying to compile my BeerSelect2.java in the 'web' folder in which I'm trying to import the com.example.model.* ;
ie In the Command Prompt:
C:\MyProjects\beerV1\src\com\example\web>javac BeerSelect2.java
gives 3 errors like this
BeerSelect2.java:3: package com.example.model does not exist
import com.example.model.*
^
BeerSelect2.java:22:cannot find symbol
symbol: class BeerExpert
location: class com.example.web.BeerSelect2.
BeerExpert be=new BeerExpert();
^
BeerSelect2.java:22:cannot find symbol
symbol: class BeerExpert
location: class com.example.web.BeerSelect2.
BeerExpert be=new BeerExpert();
Can anyone help???
My 2 java files BeerSelect2.java & BeerExpert.java are in packages com.example.web & com.example.model respectively. The root folders goes like this.
C:\MyProjects\beerV1\src\com\example\web\BeerSelect2.java
and
C:\MyProjects\beerV1\src\com\example\model\BeerExpert.java
I have compiled the BeerExpert.java in the model package.(ie the class file for BeerExpert is in the com.example.model package.)
My BeerSelect2 file which is inside the web folder is like this
This shows 3 comile errors.
& the BeerExpert.java file which is in the model folder is like this:
This compiles fine in the model folder.
Now in the above BeerSelect2.java program(Servlet)-- when I'm trying to compile my BeerSelect2.java in the 'web' folder in which I'm trying to import the com.example.model.* ;
ie In the Command Prompt:
C:\MyProjects\beerV1\src\com\example\web>javac BeerSelect2.java
gives 3 errors like this
BeerSelect2.java:3: package com.example.model does not exist
import com.example.model.*
^
BeerSelect2.java:22:cannot find symbol
symbol: class BeerExpert
location: class com.example.web.BeerSelect2.
BeerExpert be=new BeerExpert();
^
BeerSelect2.java:22:cannot find symbol
symbol: class BeerExpert
location: class com.example.web.BeerSelect2.
BeerExpert be=new BeerExpert();
Can anyone help???