File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Classpath, packages and Windows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Classpath, packages and Windows" Watch "Classpath, packages and Windows" New topic

Classpath, packages and Windows

Stephen Bridgett

Joined: May 14, 2000
Posts: 2
I'm a new guy so be kind when you tell me this question has been asked 100 times.
I want to install some custom classes. Actual Bruce Eckel's by permission. I am wondering where the java jdk classes live and where I should start my \com\... class library tree. I have tried many locations and each time I am informed that 'package com\bruceeckel\swing' does not exist. Here is what I've tried:
I have the class (Console) in a subdirectory as specified in the package statement. I have put the com\... below my classpath directory, in the jdk below the libs, in the windows directory below java classes.
So my question is where do I put it or what am I doing wrong?
Tom P
Ranch Hand

Joined: May 06, 2000
Posts: 88
The location is based on the CLASSPATH variable. If the CLASSPATH is pointing to /java/lib then you need to place your directory in that directory so that you end up with: /java/lib/com/bruceeckel/swing
Stephen Bridgett

Joined: May 14, 2000
Posts: 2
Hmm Tom
My 3rd party class called Console is located at
and is called Console.class
I compile my app in a separate directory but the first directory of my classpath is '.'
Any suggestions?
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
1. Please bear in mind that Java is case-sensitive so your directories and filenames should always exactly match the names of packages and classes.
2. I'm worries that you seem to be confusing PATH and CLASSPATH. PATH is used by The operating system or command shell to locate executable programs and batch files. CLASSPATH is used by the Java virtual machine to load classes. In most systems only executable programs and batch files (such as "java.exe") should exist in the "bin" directory. Your class files should be in a separate directory structure (say d:\java). So your settings would look something like:
and your files would be located, for example:
You should then be able to run the Console class by typing
java com.bruceeckel.console.Console

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: Classpath, packages and Windows
It's not a secret anymore!