The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


need to include import com.bruceeckel.swing.* ?? how

Posted by Matt Gerrans on November 30, 2001 at 12:56 PM

Everything you need is included in the source code zip file you downloaded. When you unzip it, there will be a com directory, among others. The directory where you unzipped the code needs to be added to your classpath environment variable.

If you want to be tricky, you can just add ".." to your classpath, then when you are in any of the directories with a particular chapter's code the compile will correctly resolve it, as well (but there are a few where there is more code in subdirectories of the chapter, which means you'd need to add "../.." to the classpath).

Generally speaking, if you have a package import, eg:
and the files are in (with Windows platform syntax):
then your classpath needs to include c:\somepath. If your classpath is not currently empty, then you add an item to it like this (on the command line):
set classpath=%classpath%;c:\somepath
If the package is in a jar file, then the classpath needs to contain the fully qualified name of the jar file (not just its path).

- Matt

> Howdie,

> I have jdk1.3.1 installed on my Windows system.

> Recently purchased Bruce Eckel's book Thinking In Java.
> Downloaded programs off of web, CD rom did not include code only c++ instead of java.

> Bruce Eckel's example uses packages which he developed.

> When I compile the Bruce Eckels's java source code examples
> which include "import com.bruceeckel.swing.*" or "package
> com.bruceeckel.swing", I get compilation error that reads
> "package com.bruceeckel.swing does not exist". I do not believe I have it.
> or the ... compiler cannot find it ... so

> Thanks in advance for any and all suggestions/help.

> Need to turn in my assigment urgently and hope to use the book as a source of reference but it has been difficult throughout the
> entire semester since I have not known how to deal with this. I will probably need it for data structures too next semester. Please help as soon as possible. Thank you again.

> Sylvia Miner


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us