#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2008
    Posts
    5
    Rep Power
    0

    Importing a JAR file with eclipse


    Hi everybody,

    I have a little problem with a project in Java.
    I use Eclipse and I have a JAR files wich corresponds to a compiled package (several .class files), I need this package to be a part of my project and I don't know how to do it.

    Do you know what I have to do to import that package ?

    Thank you for helping !
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    Finland
    Posts
    716
    Rep Power
    51
    Originally Posted by Misterchaum
    Hi everybody,

    I have a little problem with a project in Java.
    I use Eclipse and I have a JAR files wich corresponds to a compiled package (several .class files), I need this package to be a part of my project and I don't know how to do it.

    Do you know what I have to do to import that package ?

    Thank you for helping !
    In project explorer right click on the folder/package where you want to import the JAR. Then choose "Import". In the import wizard, select General > File system. Browse for the JAR and select it.

    Now you imported the JAR, but before you can use it, you need to add it to the classpath. Once again in project explorer right click on the project root folder, select Properties. In the properties menu select Java Build Path. In Java Build Path open the libraries tab and click on "Add JARs..." and browse for the JAR you just imported.

    If you do not wish to actually import the package to your project but just use it, then you can skip the first part of this instruction and directly go to the "Libraries" tab in the Java Build Path. This time you should click on "Add external JARs..." and browse for the JAR in your file system.
    Fatal error on row 561: Couldn't access life - life isn't set
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2008
    Posts
    5
    Rep Power
    0
    Originally Posted by Kimppa
    In project explorer right click on the folder/package where you want to import the JAR. Then choose "Import". In the import wizard, select General > File system. Browse for the JAR and select it.

    Now you imported the JAR, but before you can use it, you need to add it to the classpath. Once again in project explorer right click on the project root folder, select Properties. In the properties menu select Java Build Path. In Java Build Path open the libraries tab and click on "Add JARs..." and browse for the JAR you just imported.

    If you do not wish to actually import the package to your project but just use it, then you can skip the first part of this instruction and directly go to the "Libraries" tab in the Java Build Path. This time you should click on "Add external JARs..." and browse for the JAR in your file system.
    Thanks, it works !

IMN logo majestic logo threadwatch logo seochat tools logo