Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro Java
|
Pro Java Expert level Java questions not about a specific book. Please indicate your version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Java section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 13th, 2007, 08:07 AM
JSP JSP is offline
Registered User
 
Join Date: Dec 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Complilation Problem

hello!!

can anyone help me.
I am a studying from a Book "Beginning JSP WEB Development.
I am in Chapter 7 where i have created a class Book. Efter that i have created a class ChildrenBook and TechnicalBook which are inheritance of the class Book.
I have saved all my file in &CATALINA_HOMe%\webapps\begjsp-ch07\WEB-INF\classes\com\wrox\library.
I can compile class Book, but I cannot compile Class ChildrenBook and TechnicalBook.

I get a following message when I do so
cannot find symbol class Book
public class ChildrenBook extends Book
1 error



 
Old December 13th, 2007, 10:08 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

see that the Book.class is in your class path.
As the other two classes are extending it the base class should be in class path.

- Rakesh
 
Old December 13th, 2007, 11:21 AM
JSP JSP is offline
Registered User
 
Join Date: Dec 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have all three classes Book, ChildrenBook and Technical Book in the same folder %CATALINA_HOME%\webapps\begjsp-ch07\com\wrox\library.

but still i get that message.

 
Old December 24th, 2007, 06:18 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

I mean to say that if Book is in a separate package then you need to see that all the classes are placed in proper directories. for example if Book class is in a package com.wrox.library.chap7and the other two are in com.wrox.library.chap7.sub then the .class file should be in the following directories

Book.class -> WEB-INF/classes/com/wrox/library/chap7
Other two .class files -> WEB-INF/classes/com/wrox/library/chap7/sub

You can use the -d option while compiling java file and specify where to put the .class files, so that all the package directory structure will be taken care by the compiler itslef.

If you give javac -d . *.java the all the .java files will be compiled and placed in the current directory and package directory structure will be created by the compiler itself.


- Rakesh









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.