permaculture playing cards*
The moose likes Beginning Java and the fly likes Package import / Distribution Question 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 "Package import / Distribution Question" Watch "Package import / Distribution Question" New topic
Author

Package import / Distribution Question

Cecil Phillip
Ranch Hand

Joined: Nov 05, 2001
Posts: 40
I recently got a api(which is basically a single package) to help me work on mp3 tags. I have a fair understanding of how put the package to use but I just need a few things cleared.
1. How\Where can I put the package such that it wouldn't have to be in the same directoty for me to import it into a project; kinda making it like an extension of the core api ?
2. When distributing programs that use this package, would I have to include the entire package alot with the rest of the project's classes ?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Cecil,

1. How\Where can I put the package such that it wouldn't have to be in the same directoty for me to import it into a project; kinda making it like an extension of the core api ?

You can put it in the <SDK>/jre/lib/ext/ dirctory, but that's probably not a real great idea since that is really for true Java extensions like the Java3D lib. Admittedly, I put some libs in there that I use a lot like the MySql JDBC driver lib. You're really better off creating a project directory and putting the lib there. For example, if you have a package mp3.tags and com.cecil.myproject, then you would want a dirctory structure like:
MyProject/mp3/tags // tags source here
MyProject/com/cecil/myproject // your source here
If you do that, then it is going to be much easier to jar it up for distribution.

2. When distributing programs that use this package, would I have to include the entire package alot with the rest of the project's classes ?

Yep, unless you get very lucky and the machine already has the non-standard package there and the CLASSPATH is set to locate it. All in all you probably win the lottery before that happens. As I said earlier, for distribution, you'll want to jar it anyway and can easily include both packages in the jar.
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Package import / Distribution Question
 
Similar Threads
Two packages, one Interface ?????
How to use class inside the default package inside other packages!!
Simple Question
package problems
JSF API doubt please help me