[LWJGL] How to change natives in code

How would I change the natives of a lwjgl game in code? So that in the main method when the game starts up it will find the OS and then change to the respective native folder.

Throw all the natives in one folder and you don’t have to worry about it.

Like heroes said, just put it into one folder and set the property like this:
[icode]System.setProperty(“org.lwjgl.librarypath”, new File("./libraries/natives/").getAbsolutePath());[/icode]

Spacebeans’ way of setting it from OS name

package passage.games.util;

import java.io.File;

public class NativesUtil {
   public static String OSNAME;
   public static String NATIVES_PATH;
   
   public static void setNativesPathToOS(){
      OSNAME = System.getProperty("os.name").toLowerCase();
      if(OSNAME.contains("win"))NATIVES_PATH = "project-assets/natives/windows/";
      else if(OSNAME.contains("mac"))NATIVES_PATH = "project-assets/natives/macosx";
      else if(OSNAME.contains("lin"))NATIVES_PATH = "project-assets/natives/linux";
      else if(OSNAME.contains("sol"))NATIVES_PATH = "project-assets/natives/solaris";
      else System.out.println("Sorry, your operating system is not supported.");
      
      System.setProperty("org.lwjgl.librarypath", new File(NATIVES_PATH).getAbsolutePath());
   }
}