Question

I'm a beginner programmer and am looking to utilize some features from within an API I came across on the internet, http://ini4j.sourceforge.net/ is the link to the API, it allows Java to interface with .ini files. I've downloaded the archive containing all the files necessary to import, but I'm not sure how to import them into Eclipse so that I can use them with my Java project, any help would be greatly appreciated.

Was it helpful?

Solution

The easiest way is to create a new folder under your project e.g. lib and copy all the jar files of the library you want to use to this lib folder (note you can do all of this from inside eclipse)

Refresh your eclipse project, so the new files show up. Right click on them and select Build Path -> Add to Build Path

You can also right click on your project and select Build Path -> Configure Build Path

OTHER TIPS

I would actually recommend taking a look at maven. It is a tool that helps you manage your builds, dependencies, ...

This way if you ever want to check your code into a source code repository you don't need to also commit your jar files, and it makes it much easier to update your files.

Quick sample:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.kanescharles.iniProject</groupId>
    <artifactId>iniProject</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>iniTest</name>
    <url>http://www.kanecharles.com/iniTest</url>
    <build>
        <finalName>iniTest</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.ini4j</groupId>
            <artifactId>ini4j</artifactId>
            <version>0.5.2</version>
        </dependency>        
    </dependencies>  
</project>

For Eclipse you have the m2eclipse plugin, and if you want to look up dependencies I would recommend mvnRepository

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top