my dog learned polymorphism
The moose likes Beginning Java and the fly likes bypassing the classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "bypassing the classpath" Watch "bypassing the classpath" New topic

bypassing the classpath

Dan Maples
Ranch Hand

Joined: Jun 21, 2004
Posts: 153
Hey guys, I have written a program to make things easyer when I write other programs. The problem I am having is when I use it in other programs and go to compile the other programs I end up having to type in 10 or so different classpaths to get it to compile properly. Is there something I can do to the program that will make it so that I don't have to type in 10 classpaths when compileing the other programs. I have heard of packages, but I don't know much about them and if they will help or not in my case. Thanks in advance-Dan

Jon Entwistle
Ranch Hand

Joined: Feb 20, 2003
Posts: 118
Hi Dan,

Packages are ways of logicaly grouping your source files and should be used for all applications which you write.

For writing your own reusable classes this is important - by writing your classes in a package (say myPackage), compiling them and puting the compiled files on your classpath, you can reuse your classes with:

import myPackage.*; // * imports all files in the package myPackage

Do a quick search on google for a java package tutorial and you will soon be up to speed.



Dan Maples
Ranch Hand

Joined: Jun 21, 2004
Posts: 153
thanks Jon
Consider Paul's rocket mass heater.
subject: bypassing the classpath
It's not a secret anymore!