Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Project with native libraries for different platforms

Tags:

java

eclipse

I have a java project that uses JOGL and therefore needs to include different native libraries for different platforms. Now I want to set up the eclipse project to automatically chose the correct libraries. In the .classpath file you can specify one native location:

<classpathentry kind="lib" path="lib/jogl/jar/jogl.all.jar">
    <attributes>
        <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="de.yogularm.desktop/lib/jogl/windows-amd64"/>
    </attributes>
</classpathentry>

If multiply classpathentries specify a native location, Eclipse also tries to load the libraries for other platforms and fails.

How can I make eclipse chose the directory? I want to share the project and make setup for further developers as easy as possible.

like image 982
Yogu Avatar asked Mar 22 '26 10:03

Yogu


1 Answers

You can create several .classpath files (.classpath_Windows, .classpath_Linux etc.) and then create symbolic link to required version (Win/Lin/Mac) named ".classpath"
The problem will appear whan you want to change any entry inside any .classpath_XXXXXXX - then you will have to update other .classpath files.

like image 100
anakkin Avatar answered Mar 25 '26 00:03

anakkin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!