PDA

View Full Version : *Awkard* Beginner Question :: Unusual Classes




bobber205
Sep 21, 2006, 11:21 AM
This? (http://www.dom4j.org/guide.html)

If I were to use that api in my java class, would user have to have that installed to use my class? Or does compiling take care of that?



mufflon
Sep 21, 2006, 11:30 AM
This? (http://www.dom4j.org/guide.html)

If I were to use that api in my java class, would user have to have that installed to use my class? Or does compiling take care of that?


Nope, as long as you compiie it I see no problems at all - and this quesion isn't very awkward, all the .class needs should be included within itself.

robbieduncan
Sep 21, 2006, 11:38 AM
Yes the user would have to have that class installed unless you bundle it up in your jar file yourself. When you compile on your system Java simply looks to see if the class is there. When you deploy your class on another machine you need to deploy this API as well. Java does not statically link the other classes in.

bobber205
Sep 21, 2006, 12:09 PM
http://www.jdom.org/

I would like to use that. But I'm not sure how to compile it so I can distribute it.

robbieduncan
Sep 21, 2006, 01:05 PM
Either get the jar (like a zip) of the compiled jdom and unzip it or get the source and compile it. The compile your own code and bundle your code and the jdom stuff into one big jar. Job done.

You will need to check you are legally entitled to distribute jdom with your code and if there are any requirements in doing so (accreditation etc).

bobber205
Sep 21, 2006, 02:48 PM
I have the classes importing. One thing though. They came in a org.jdom hierarchy layout.
If I have to use more code to complete my project, and it starts with org, what do I do?

I tried to head off this problem by putting the org folder in a jdom folder, but the compilier doesn't like that. :D

robbieduncan
Sep 21, 2006, 03:07 PM
They all have to live in org/ relative to the classroot (the root of the folder you make into your jar).

jeremy.king
Sep 21, 2006, 03:26 PM
Any reason you need to use JDOM? The JDK already has pretty sophisticated XML APIs, including DOM and SAX implementations.

weg
Sep 21, 2006, 04:57 PM
I have the classes importing.

Unlike include in C/C++, import does actually nothing. Well, at least not very much: It just provides information where to look for the class files (relative to the directory the application resides in or to the CLASSPATH.
If you want to package an application, you should put everything you need into a JAR, or provide information where the user can find the classes that you don't ship.