How to configure Eclipse project libraries to compile both on Windows and Linux?

会有一股神秘感。 提交于 2019-12-24 10:07:30

问题


It's a simple OpenGL app. The problem is, JOGL needs native libraries, and I need to set "Native library location", which is different for Windows and Linux. Is it possible to share project settings between platforms?

I want to make the workspace setup process as simple as "checkout from SVN, compile, run".


回答1:


If it's just Windows and Linux, you can put them in the same folder, as j flemm states.

The reason it works is because of the definition of System.loadLibrary() in Java:

loadLibrary

public static void loadLibrary(String libname)

Loads the system library specified by the libname argument. The manner in which a library name is mapped to the actual system library is system dependent.

That means System.loadLibrary("jogl") will try to load jogl.dll on Windows and libjogl.so on Linux. It's pretty nice.



来源:https://stackoverflow.com/questions/3618425/how-to-configure-eclipse-project-libraries-to-compile-both-on-windows-and-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!