AJF
AJF

Reputation: 1921

Windows environment variable in Java build path

How do I use a Windows environment variable to specify where a jar is located in an Eclipse project build path?

The JAVA_HOME environment variable for example could be in a different location on the server than on my PC, but if I have JAVA_HOME set as an environment variable on both machines, how can I specify in Eclipse to use a jar in the JAVA_HOME so it is the same on both machines?

Upvotes: 1

Views: 509

Answers (1)

djangofan
djangofan

Reputation: 29669

If your using Maven, just put an entry in your pom.xml like this:

<dependency>
    <artifactId>com.mysite</artifactId>
    <groupId>mylib</groupId>
    <version>${mylib.version}</version>
    <scope>system</scope>
    <systemPath>${basedir}/lib/mylib-1.0.0-SNAPSHOT.jar</systemPath>
</dependency>

This requires you install the Maven M2E plugin for Eclipse.

Upvotes: 1

Related Questions