1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

*Awkard* Beginner Question :: Unusual Classes

Discussion in 'Mac Programming' started by bobber205, Sep 21, 2006.

  1. macrumors 68020



    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?
  2. macrumors 6502


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


    Staff Member

    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.
  4. macrumors 68020



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


    Staff Member

    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).
  6. macrumors 68020


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


    Staff Member

    They all have to live in org/ relative to the classroot (the root of the folder you make into your jar).
  8. macrumors 603


    Any reason you need to use JDOM? The JDK already has pretty sophisticated XML APIs, including DOM and SAX implementations.
  9. weg
    macrumors 6502a


    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.

Share This Page