5 Replies Latest reply: Jan 14, 2008 5:28 PM by 807601 RSS

    Adding JAR files to project

    807601
      Hi there guys, I am VERY new to java so please bare with me here.

      I just recently outsourced a java project and they have returned me the NetBeans project folder, which I can open fine. But they've also included some JAR files
      which I'm not sure how to include in my application:

      do I need to create a folder among the usual suspects [  build, nbproject, src, test ] and copy the file (jfreechart-1.0.8.jar) there?

      this is the code which currently isn't very happy:
      import org.jfree.chart.ChartFactory;
      import org.jfree.chart.ChartMouseEvent;
      import org.jfree.chart.ChartMouseListener;
      import org.jfree.chart.JFreeChart;
      many thanks help much appreciated !
      Gerry
      jar-newbie
        • 1. Re: Adding JAR files to project
          791266
          The project is probably already configured to have those jars on the classpath, so you need to check the settings for the project and place the jars at the specified location. (Don't know if the is how NetBeans works but that's how most IDEs work)

          Kaj
          • 2. Re: Adding JAR files to project
            807601
            i dont know whether to include these JARs in the 'library' node of the NetBeans project or not?

            The project node is problematic: it says there are unreferenced libraries (with the same names as the JAR files that I have been sent... unfortunately I cant get hold of this person who sent me it !! :-((

            help appreciated !
            Gerry
            • 3. Re: Adding JAR files to project
              791266
              gvanto wrote:
              i dont know whether to include these JARs in the 'library' node of the NetBeans project or not?

              The project node is problematic: it says there are unreferenced libraries (with the same names as the JAR files that I have been sent... unfortunately I cant get hold of this person who sent me it !! :-((

              help appreciated !
              Gerry
              That error message, or the project, should tell you where it expects the jar to be placed.

              Kaj
              • 4. Re: Adding JAR files to project
                807601
                If the application you are building,editing or running uses the referred jar files, they must be on the classpath.For NetBeans, the best way is to add them to the project library and recompile.
                It may be, as you are saying, the additions have already been made.Open the project in NetBeans and expand the "Libraries" node.See if the jar files are already there.If they are, apprentluy these jars have been given unnecessarily.Run the application and see.
                On the other hand, the message you are getting(where is it dispalyed, by the way?)seems to indicate that the application has not(yet) incorporated these jars.
                • 5. Re: Adding JAR files to project
                  807601
                  I have now:
                  -copied the jar files to a folder 'lib' in the 't9_applet' folder (on the same level as 'build', 'src' and 'test')
                  - I then right-clicked the "libraries" node in the "Projects" view and added the JAR files in the 'lib' folder.

                  But I still get Unresolved problems on the project node:

                  When I click 'Resolve Reference Problems' (on project node, after right-clicking on it),
                  it says it cant find the "JFreeChart-1.0.9" library (even though I've added the file jfreechart-1.0.9.jar to the libraries node )

                  (at first it also said it couldnt find .jar files, which was resolved after I added them to the libraries node, but now it still complains about the 'Libraries' not being found ... what to do???)

                  I am still completely lost ... if anyone has a good tutorial on how jar's and libraries and NetBeans all link together that'd be really appreciated ...

                  thanks for help guys
                  Gerry
                  ps: does JDK1.5 support this property: String.isEmpty() ? I cant tell from this link: http://java.sun.com/javase/6/docs/api/java/lang/String.html