Solved

class with extend compile issue...

Posted on 2012-04-03
3
391 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about a problem I had getting the GPS LocationListener working.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

912 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

20 Experts available now in Live!

Get 1:1 Help Now