Solved

class with extend compile issue...

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
creating threads in delphi 1 103
egit plugin on eclipse 8 63
null output 3 25
ASP/VB email question 4 33
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 …
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…

776 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