Hey all, I’m hitting a bit of a snag with something that should be simple. I’ve tried many methods (including jarsplice and similar programs) to get my natives working on Mac and Linux, the problem is, I don’t have a Mac or Linux machine to test my game on. But it seems no matter what I do, I get the “java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path” error from my Mac and Linux users who test the program.
The latest way I’ve tried to force native support (that removes the need for jarsplice or anything like it) is to hack my java.lang.path by launching the game with this method:
package core;
import java.lang.reflect.Field;
public class Launcher {
public static void main(String[] args) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
System.setProperty("java.library.path", "lib/natives;lib/jars;"+System.getProperty("java.library.path"));
final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
sysPathsField.setAccessible(true);
sysPathsField.set(null, null);
System.out.println(System.getProperty("java.library.path"));
Game.launchGame();
}
}
It works great for PCs, I can just export the jar and run it on any PC with Java 1.6+ with no trouble. But I still get the natives error on the other 2 OSes. It should also be noted all my natives are in lib/natives/, they’re not in subfolders.
Normally I figure I can solve this problem myself, but without access to a Mac I can’t exactly troubleshoot the problem, and all the solutions I’ve looked for seem to not be working, where you’d think this should be an easy fix.
I’m not too familiar with Macs since I avoid them, is their file structure different somehow? Is folderYouLaunchedIn/lib/natives not lib/natives/ as the machine sees it on a mac? I have a feeling my problem is something painfully simple, but I’m just not seeing it.