Re: Help with -classpath and packages
- From: "Fergus Gibson" <nospam@xxxxxxxxxxx>
- Date: Wed, 28 Jun 2006 10:24:51 GMT
Sigmund Hansen wrote:
Well, the Car.java file should really be placed inside a directory
called com/example/rentalcar
This is why it tells you to place it in the correct subdirectory,
or at least I think it is.
Yes, Sigmund, I think you've got it. The compiler can't find the Car.java
file where it expects it in order to ensure that it's being used properly by
TestCar.java.
Derek, it's important to conceive of the -cp and -d switches as referring to
the root of a directory tree. When you're using packages, you need to have
a full path representing the package (com/example/rentalcar/) as Sigmund has
said. Java is organized hierarchially, and it applies this to both its
source file and its compiled files.
I'd recommend you use NetBeans or Eclipse to do your projects though,
it would simplify these tasks a lot.
I tried to get into using an IDE, but I never could. I don't like how they
put each project into its own directory. I use a text editor and two
hierarchies, one under "source" and one under "classes". This way I can
import anything from anywhere in my tree with a simple import statement,
which I could find any easy way to do in an IDE due to the class and source
files being distributed into many different project dirs.
I always felt like I was missing something when I tried to use them, like
there had to be some easy way to do it...
.
- Follow-Ups:
- Re: Help with -classpath and packages
- From: Sigmund Hansen
- Re: Help with -classpath and packages
- References:
- Help with -classpath and packages
- From: dlarsson
- Re: Help with -classpath and packages
- From: Sigmund Hansen
- Help with -classpath and packages
- Prev by Date: can't fully unload a URLClassLoader
- Next by Date: Re: How many deprecated methods have been removed?
- Previous by thread: Re: Help with -classpath and packages
- Next by thread: Re: Help with -classpath and packages
- Index(es):