/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package com.badlogic.gdx.backends.lwjgl3;

import java.io.File;
import java.lang.reflect.Method;

import com.badlogic.gdx.utils.GdxNativesLoader;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.SharedLibraryLoader;

public final class Lwjgl3NativesLoader {
	static public boolean load = true;

	static {
		System.setProperty("org.lwjgl.input.Mouse.allowNegativeMouseCoords", "true");

		// Don't extract natives if using JWS.
		try {
			Method method = Class.forName("javax.jnlp.ServiceManager").getDeclaredMethod("lookup", new Class[] {String.class});
			method.invoke(null, "javax.jnlp.PersistenceService");
			load = false;
		} catch (Throwable ex) {
			load = true;
		}
	}

	/** Extracts the LWJGL native libraries from the classpath and sets the "org.lwjgl.librarypath" system property. */
	static public void load () {
		GdxNativesLoader.load();
		if (GdxNativesLoader.disableNativesLoading) return;
		if (!load) return;

		SharedLibraryLoader loader = new SharedLibraryLoader();
		File nativesDir = null;
		try {
			if (SharedLibraryLoader.isWindows) {
				nativesDir = loader.extractFile(SharedLibraryLoader.is64Bit ? "lwjgl.dll" : "lwjgl32.dll", null).getParentFile();
				loader.extractFile(SharedLibraryLoader.is64Bit ? "glfw.dll" : "glfw32.dll", nativesDir.getName());
				loader.extractFile(SharedLibraryLoader.is64Bit ? "jemalloc.dll" : "jemalloc32.dll", nativesDir.getName());				
				loader.extractFile(SharedLibraryLoader.is64Bit ? "OpenAL.dll" : "OpenAL32.dll", nativesDir.getName());				
			} else if (SharedLibraryLoader.isMac) {
				nativesDir = loader.extractFile("liblwjgl.dylib", null).getParentFile();
				loader.extractFile("libglfw.dylib", nativesDir.getName());
				loader.extractFile("libjemalloc.dylib", nativesDir.getName());
				loader.extractFile("libopenal.dylib", nativesDir.getName());
			} else if (SharedLibraryLoader.isLinux) {
				nativesDir = loader.extractFile(SharedLibraryLoader.is64Bit ? "liblwjgl.so" : "liblwjgl32.so", null).getParentFile();				
				loader.extractFile(SharedLibraryLoader.is64Bit ? "libglfw.so" : "libglfw32.so", nativesDir.getName());
				loader.extractFile(SharedLibraryLoader.is64Bit ? "libjemalloc.so" : "libjemalloc32.so", nativesDir.getName());				
				loader.extractFile(SharedLibraryLoader.is64Bit ? "libopenal.so" : "libopenal32.so", nativesDir.getName());
			}
		} catch (Throwable ex) {
			throw new GdxRuntimeException("Unable to extract LWJGL natives.", ex);
		}
		System.setProperty("org.lwjgl.librarypath", nativesDir.getAbsolutePath());
		load = false;
	}
}

@@ -823,203 +823,41 @@
 ort 
-java.io.File;%0D%0Aimport java.lang.reflect.Method;%0D%0A%0D%0Aimport com.badlogic.gdx.utils.GdxNativesLoader;%0D%0Aimport com.badlogic.gdx.utils.GdxRuntimeException;%0D%0Aimport com.badlogic.gdx.utils.SharedLibrary
+com.badlogic.gdx.utils.GdxNatives
 Load
@@ -908,45 +908,8 @@
 r %7B%0D
-%0A%09static public boolean load = true;%0D
 %0A%0D%0A%09
@@ -1003,2195 +1003,70 @@
 );%0D%0A
-%0D%0A%09%09// Don't extract natives if using JWS.%0D%0A%09%09try %7B%0D%0A%09%09%09Method method = Class.forName(%22javax.jnlp.ServiceManager%22).getDeclaredMethod(%22lookup%22, new Class%5B%5D %7BString.class%7D);%0D%0A%09%09%09method.invoke(null, %22javax.jnlp.PersistenceService%22);%0D%0A%09%09%09load = false;%0D%0A%09%09%7D catch (Throwable ex) %7B%0D%0A%09%09%09load = true;%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%0D%0A%09/** Extracts the LWJGL native libraries from the classpath and sets the %22org.lwjgl.librarypath%22 system property. */%0D%0A%09static public void load () %7B%0D%0A%09%09GdxNativesLoader.load();%0D%0A%09%09if (GdxNativesLoader.disableNativesLoading) return;%0D%0A%09%09if (!load) return;%0D%0A%0D%0A%09%09SharedLibraryLoader loader = new SharedLibraryLoader();%0D%0A%09%09File nativesDir = null;%0D%0A%09%09try %7B%0D%0A%09%09%09if (SharedLibraryLoader.isWindows) %7B%0D%0A%09%09%09%09nativesDir = loader.extractFile(SharedLibraryLoader.is64Bit ? %22lwjgl.dll%22 : %22lwjgl32.dll%22, null).getParentFile();%0D%0A%09%09%09%09loader.extractFile(SharedLibraryLoader.is64Bit ? %22glfw.dll%22 : %22glfw32.dll%22, nativesDir.getName());%0D%0A%09%09%09%09loader.extractFile(SharedLibraryLoader.is64Bit ? %22jemalloc.dll%22 : %22jemalloc32.dll%22, nativesDir.getName());%09%09%09%09%0D%0A%09%09%09%09loader.extractFile(SharedLibraryLoader.is64Bit ? %22OpenAL.dll%22 : %22OpenAL32.dll%22, nativesDir.getName());%09%09%09%09%0D%0A%09%09%09%7D else if (SharedLibraryLoader.isMac) %7B%0D%0A%09%09%09%09nativesDir = loader.extractFile(%22liblwjgl.dylib%22, null).getParentFile();%0D%0A%09%09%09%09loader.extractFile(%22libglfw.dylib%22, nativesDir.getName());%0D%0A%09%09%09%09loader.extractFile(%22libjemalloc.dylib%22, nativesDir.getName());%0D%0A%09%09%09%09loader.extractFile(%22libopenal.dylib%22, nativesDir.getName());%0D%0A%09%09%09%7D else if (SharedLibraryLoader.isLinux) %7B%0D%0A%09%09%09%09nativesDir = loader.extractFile(SharedLibraryLoader.is64Bit ? %22liblwjgl.so%22 : %22liblwjgl32.so%22, null).getParentFile();%09%09%09%09%0D%0A%09%09%09%09loader.extractFile(SharedLibraryLoader.is64Bit ? %22libglfw.so%22 : %22libglfw32.so%22, nativesDir.getName());%0D%0A%09%09%09%09loader.extractFile(SharedLibraryLoader.is64Bit ? %22libjemalloc.so%22 : %22libjemalloc32.so%22, nativesDir.getName());%09%09%09%09%0D%0A%09%09%09%09loader.extractFile(SharedLibraryLoader.is64Bit ? %22libopenal.so%22 : %22libopenal32.so%22, nativesDir.getName());%0D%0A%09%09%09%7D%0D%0A%09%09%7D catch (Throwable ex) %7B%0D%0A%09%09%09throw new GdxRuntimeException(%22Unable to extract LWJGL natives.%22, ex);%0D%0A%09%09%7D%0D%0A%09%09System.setProperty(%22org.lwjgl.librarypath%22, nativesDir.getAbsolutePath());%0D%0A%09%09load = false
+%09%7D%0D%0A%0D%0A%09static public void load () %7B%0D%0A%09%09GdxNativesLoader.load()
 ;%0D%0A%09

Remove custom library loading code, which is well managed by LWJGL's own SharedLibraryLoader.