Solved

class with extend compile issue...

Posted on 2012-04-03
3
389 Views
Last Modified: 2012-04-05
I have three classes in a folder. BookNew.java compiles fine.
ChildrenBook.java and TechnicalBook.java give the following error:

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\begjsp-ch07x\WEB-
INF\classes\com\wrox\library>javac TechnicalBook.java
TechnicalBook.java:3: cannot resolve symbol
symbol  : class BookNew
location: class com.wrox.library.TechnicalBook
public class TechnicalBook extends BookNew {
                                   ^
1 error

Howver, when I inlculde BooNew.java in the same files as ChildrenBook.java and TechnicalBook.java (with public removed). they complile fine.

Question: How can I compile them saved in seperate files?
BookNew.java
ChildrenBook.java
TechnicalBook.java
0
Comment
Question by:Mike Eghtebas
  • 2
3 Comments
 
LVL 27

Expert Comment

by:rrz
ID: 37802489
I answered this in your last question.
http://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q_27659256.html#a37799075    
use  
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\begjsp-ch07x\WEB-INF\classes\com\wrox\library>javac  *.java
0
 
LVL 33

Author Comment

by:Mike Eghtebas
ID: 37802644
I ran and it works. There was a few thing my mind (with a litle ram) was busy with in the last question.

I guess this is the only way to do it. Does it has something to do with "package com.wrox.library;" line we are including here?

I have done many other times by

C:>...>ProkectFolder>javac SubClass.java

with SuperClass.java in the same folder.

Why worked then but it is not working here?

Mike
0
 
LVL 27

Accepted Solution

by:
rrz earned 500 total points
ID: 37802984
>Why worked then but it is not working here?  
The compiler is looking for the package structure containing BookNew.class. Look at the beginning of  
http://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q_27659256.html#a37799075
See that I added
-cp "C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\begjsp-ch07\WEB-INF\classes"  
as an option.    
I suggest you learn the basics of Ant. It is really handy.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A short article about a problem I had getting the GPS LocationListener working.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now