• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem compiling the MVC

 
saina smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam new to servlets please help with the second servlet version from HF book

When I try to compile the model class it says
Note: src\com\example\model\BeerExpert .java uses unchecked or unsafe operations
Note:Recompile with -Xlint Unchecked for details.What does it mean.

When I try to compile the BeerSelect class it says package com\example\model does does not exit even though i imported it.
 
saina smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got the solution. Ignore the above question
 
Chris Jr
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting the same error. Could you please let me know how you resolved this error. Thanks.
 
Dishaan D Ahuja
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even I am getting package com.example.model does not exist. Please help.

Regards,

Dishaan
 
Cai DongShan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you compiled BeerExpert.java in com\example\model? You should compile it first.
 
Dishaan D Ahuja
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Yes I have compiled BeerExpert.java in com\example\model.

Please help.

Regards,

Dishaan
 
Chad LaVigne
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like your class doesn't reside in a directory that matches the package statement. In other words, if your class delcares

package com.example.model;

then the source file needs to be in a com/example/model directory when you compile it and at deployment the compiled class needs to be placed in a com/example/model directory under the WEB-INF/classes directory of your deployed app. For example, if tomcat is the web container you're using it would be something like:

opt/tomcat/webapps/Beer-v1/WEB-INF/classes/com/example/model

Hope that helps.

Chad
 
Dishaan D Ahuja
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chad,

I have done exactly like you have mentioned still the same problem is continuing.

Kindly help

Dishaan
 
MI Mohammed
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ahuja,
Never give up. Let me crank you a bit. It might be long.
Just follows this step.

1. Create your development enviroment. Say crank project.
the file structure should be like this.

C:/cranks
C:/cranks/src ---- put all the source codes here.
C;/cranks/classes ----- this is where all the compiled codes
don't create anything inside. The compiler will
use the package statement to create all the folders and files for you.

2. Write the code and save it in the src dir.
cd to src dir.
then
javac -classpath ./classes:/tomcat/common/servlet-api.jar -d classes HowIsIt.java

So, i hope it will loosen you up.



SCJP 1.4 SCJA SCWCD in Prog........
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic