Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error in importing packages (import com.example.model.*) HELP!!!

 
Mercedes Regidor
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, I'm a newbie and I came across your board while searching for a solution to my problem. I believe that this has already been brought up as a question in some of the forums here:

------------------------
the problem was this:
src/com/example/web/CoffeeSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src/com/example/web/CoffeeSelect.java:4: package javax.servlet does not exist
import javax.servlet.*;

------------------------

------------------------
and the solution was:
javac -classpath c:\dev\tomcat\common\lib\servlet-api.jar:classes:.;c:\j2sdkee1.3.1\lib\j2ee.jar;c:\dev\MyProjects\beerV1\classes -d classes src/com/example/web/BeerSelect.java
------------------------

Unfortunately, adding the class directory to my classpath didn't solve the problem. I still kept on getting the:

------------------------
src/com/example/web/CoffeeSelect.java:3: package com.example.model does not exist
import com.example.model.*;

------------------------

Can somebody shed me a light on this, please? I'm using WindowsXP and I tried tinkering with the environment variables in the System Properties. They all worked for the other compilations except for this one particular thing on importing packages.

Thanks so much!
 
Mercedes Regidor
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wait, the thing above, it worked for me! Sorry about the hassle.

My problem now is how to set the WinXP environment variables so that I won't type the whole thing everytime I try to compile my source files.
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont have win xp handy, but on some windows versions, you can get to the environment variables setup applet by right clicking 'My Computer' choosing Properties and the choosing the 'Advanced' tab. You should also be able to get to System Properties somewhere from the Control Panel.

Try choosing help from the Start button, and searching for environment variables.

HTH
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also - if you are serious about Java servlet development, learn to use ANT to control compilation and perform related tasks. The learning curve to start is pretty steep, but it pays off. For one thing, defining different classpaths for different projects is very easy.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic