*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "bypassing the classpath" Watch "bypassing the classpath" New topic
Author

bypassing the classpath

Dan Maples
Ranch Hand

Joined: Jun 21, 2004
Posts: 153
Hey guys, I have written a myUtilities.java 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 myUtilities.java 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


-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.

Regards,

Jon


SCJD, SCEA
Dan Maples
Ranch Hand

Joined: Jun 21, 2004
Posts: 153
thanks Jon
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: bypassing the classpath
 
Similar Threads
Throwing and Catching Exceptions...
Compiling Java program
HelloWorld NoClassDefFoundError
Number of JVMs in a CPU
Your experiences with scripting languages