aspose file tools*
The moose likes Beginning Java and the fly likes package does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package does not exist" Watch "package does not exist" New topic
Author

package does not exist

Elton Hughes
Ranch Hand

Joined: Jun 19, 2003
Posts: 72
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

Joined: Dec 06, 2001
Posts: 3061
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


Java API Documentation
The Java Tutorial
Elton Hughes
Ranch Hand

Joined: Jun 19, 2003
Posts: 72
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

Joined: Jun 19, 2003
Posts: 72
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

Joined: Jun 19, 2003
Posts: 72
Got it!

I forgot to import java.util.*

Thank you Layne!

Elton
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: package does not exist