• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

package does not exist

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it!

I forgot to import java.util.*

Thank you Layne!

Elton
 
You guys haven't done this much, have ya? I suggest you study this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic