By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,742 Members | 2,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,742 IT Pros & Developers. It's quick & easy.

environmental variables, classpath setup and servlet.jar

P: n/a
Ric
thx for the help. im having problems with java and jsp. i think im not
settup up the enviornmental variables right in w2k advanced tab. im
using a wrox book, but the wrox book references a servlet in the
classpath environmental variable:

CLASSPATH
%CATALINA_HOME%\common\lib\servlet.jar

i dont see a servlet.jar file in that directory. i do see a
servlet-api.jar file. are they right?

i have a path set up for JAVA_HOME (c:\java) and path variable is set
up (%JAVA_HOME%\bin). i think those are working because i can compile
java files into class files. but i cant compile a sub class that
extends to a super class.

here is the code im using:

Book.java
+++++++++++++++++++++++++
package library;
public class Book
{
private String title;
public String getTitle()
{
return title;
}

public Book(String title)
{
this.title = title;
}
}

++++++++++++++++
ChildrenBook.java

package library;
public class ChildrenBook extends Book
{
private String age;
public String getAge()
{
return age;
}

public ChildrenBook(String title)
{
super(title);
}
}

++++++++++++++++++

my directory structure is this

c:\tomcat\webapps\hello\WEB-INF\classes\library

the files are placed in the library folder.

here is the error i get when i try to compile the ChildrenBook.java
file

library\ChildrenBook.java:2: cannot resolve symbol
symbol : class Book
location: class library.ChildrenBook
public class ChildrenBook extends Book
^

thx for the help.
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Ric wrote:
thx for the help. im having problems with java and jsp. i think im not
settup up the enviornmental variables right in w2k advanced tab. im
using a wrox book, but the wrox book references a servlet in the
classpath environmental variable:

CLASSPATH
%CATALINA_HOME%\common\lib\servlet.jar

i dont see a servlet.jar file in that directory. i do see a
servlet-api.jar file. are they right?

i have a path set up for JAVA_HOME (c:\java) and path variable is set
up (%JAVA_HOME%\bin). i think those are working because i can compile
java files into class files. but i cant compile a sub class that
extends to a super class.

here is the code im using:

Book.java
+++++++++++++++++++++++++
package library;
public class Book
{
private String title;
public String getTitle()
{
return title;
}

public Book(String title)
{
this.title = title;
}
}

++++++++++++++++
ChildrenBook.java

package library;
public class ChildrenBook extends Book
{
private String age;
public String getAge()
{
return age;
}

public ChildrenBook(String title)
{
super(title);
}
}

++++++++++++++++++

my directory structure is this

c:\tomcat\webapps\hello\WEB-INF\classes\library

the files are placed in the library folder.

here is the error i get when i try to compile the ChildrenBook.java
file

library\ChildrenBook.java:2: cannot resolve symbol
symbol : class Book
location: class library.ChildrenBook
public class ChildrenBook extends Book
^

thx for the help.


This is not an unusual problem, it is caused by the package directive.
When classfiles are created, they must be placed in a directory hierarchy
that reflects their package names. Make sure that all components in your
package name hierarchy is a legitimate directory for your OS platform.
So for your case, see if the \library directory exists ?
Brgds,
Herman
--
Suse Linux Professional 8.1 on Athlon 1.1 Ghz 512 Mb
Anti Spam = remove the "dot" and the "at"
Registered Linux User #264690
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.