• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package does not exist

 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am going through the book Head First Srvlets and JSP and I have run into a snag. When I go to compile a program I get the following message:

src/org/novastaff/web/TeaSelect.java:3: package org.novastaff.model does not exist

The first three lines of my code is:

package org.novastaff.web;

import org.novastaff.model.*;

The command I am using for compiling the code is:

-> javac -d classes src/org/novastaff/web/TeaSelect.java

and finally my classpath is:

-> echo $CLASSPATH
.:/Users/ehughes/Projects/ServletDevel:/Users/ehughes/Projects/teaV1:/usr/local/tomcat/jakarta-tomcat-4.1.27/common/lib/servlet.jar
->

I have to admit, I am stumped. I thought it was the classpath at first, but it looks fine.

If anyone has some thoughts, please let me know. I the mean time I will be looking through the few boos I have.

Thanks,

Elton
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to add the classes directory to your classpath, either through the CLASSPATH system variable or the -classpath command-line option.

HTH

Layne
 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Layne,

Ok, progress. I changed my compile command to:

-> javac -classpath /usr/local/tomcat/jakarta-tomcat-4.1.27/common/lib/servlet.jar:classes:. -d classes src/org/novastaff/web/TeaSelect.java

and have a new error message. Now I get:

src/org/novastaff/web/TeaSelect.java:21: cannot resolve symbol
symbol : class List
location: class org.novastaff.web.TeaSelect
List result = be.getBrands(c);
^
src/org/novastaff/web/TeaSelect.java:21: cannot resolve symbol
symbol : variable be
location: class org.novastaff.web.TeaSelect
List result = be.getBrands(c);
^
src/org/novastaff/web/TeaSelect.java:23: cannot resolve symbol
symbol : class Iterator
location: class org.novastaff.web.TeaSelect
Iterator it = result.iterator();
^
3 errors
->

An improvement. So the original error was related to classpath. But it appears that the solution has created a new classpath problem. Or am I missing something?

Thank you for your help.

Elton
 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, I found a typo so now my error message is down to:

src/org/novastaff/web/TeaSelect.java:21: cannot resolve symbol
symbol : class List
location: class org.novastaff.web.TeaSelect
List result = te.getBrands(c);
^
src/org/novastaff/web/TeaSelect.java:23: cannot resolve symbol
symbol : class Iterator
location: class org.novastaff.web.TeaSelect
Iterator it = result.iterator();
^
2 errors

So it looks like my system cannot find the packages for List and Iterator. Yes, progress is being made.

Elton
 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it!

I forgot to import java.util.*

Thank you Layne!

Elton
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic