aspose file tools*
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


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Classpath, packages and Windows" Watch "Classpath, packages and Windows" New topic
Author

Classpath, packages and Windows

Stephen Bridgett
Greenhorn

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?
Thanks
------------------
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
Greenhorn

Joined: May 14, 2000
Posts: 2
Hmm Tom
My CLASSPATH is .;D:\JDK1.2\BIN\
My 3rd party class called Console is located at
D:\JDK1.2\BIN\COM\BRUCEECKEL\CONSOLE
and is called Console.class
I compile my app in a separate directory but the first directory of my classpath is '.'
Any suggestions?
Stephen
Frank Carver
Sheriff

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:
PATH=C:\WINDOWS;C:\WINDOWS\BIN;D:\JDK1.2\BIN;.
CLASSPATH=.;D:\java
and your files would be located, for example:
d:\java\com\bruceeckel\console\Console.class
You should then be able to run the Console class by typing
java com.bruceeckel.console.Console


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Classpath, packages and Windows