Solved

class with extend compile issue...

Posted on 2012-04-03
3
396 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 34

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…

752 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