3import java.security.PrivilegedAction;
4import java.util.concurrent.atomic.AtomicBoolean;
7import org.jau.pkg.JNIJarLibrary;
8import org.jau.pkg.JarUtil;
9import org.jau.pkg.cache.TempJarCache;
10import org.jau.sec.SecurityUtil;
11import org.jau.sys.JNILibrary;
12import org.jau.sys.PlatformProps;
13import org.jau.sys.MachineDataInfo;
14import org.jau.sys.PlatformTypes.OSType;
16import org.jau.sys.PropertyAccess;
18import jau.sys.MachineDataInfoRuntime;
24 private static final String useTempJarCachePropName =
"jau.pkg.UseTempJarCache";
48 private static AtomicBoolean initializedID =
new AtomicBoolean(
false);
51 final boolean[] _isRunningFromJarURL =
new boolean[] {
false };
52 final boolean[] _USE_TEMP_JAR_CACHE =
new boolean[] {
false };
53 final boolean[] _libsLoaded =
new boolean[] {
false };
55 SecurityUtil.doPrivileged(
new PrivilegedAction<Object>() {
59 final ClassLoader cl = PlatformRuntime.class.getClassLoader();
61 final Uri platformClassJarURI;
63 Uri _platformClassJarURI =
null;
65 _platformClassJarURI = JarUtil.getJarUri(PlatformRuntime.class.getName(), cl);
66 }
catch (
final Exception e) { }
67 platformClassJarURI = _platformClassJarURI;
69 _isRunningFromJarURL[0] =
null != platformClassJarURI;
71 _USE_TEMP_JAR_CACHE[0] = ( PlatformProps.OS != OSType.ANDROID ) && ( PlatformProps.OS != OSType.IOS ) &&
72 (
null != platformClassJarURI ) &&
73 PropertyAccess.getBooleanProperty(useTempJarCachePropName,
true,
true);
76 if(_USE_TEMP_JAR_CACHE[0] && TempJarCache.initSingleton() && TempJarCache.isInitialized(
true) ) {
78 JNIJarLibrary.addNativeJarLibs(
new Class<?>[] { org.jau.sys.Debug.class },
null);
79 }
catch (
final Exception e0) {
81 _USE_TEMP_JAR_CACHE[0] =
false;
82 System.err.println(
"Caught "+e0.getClass().getSimpleName()+
": "+e0.getMessage()+
", while JNILibLoaderBase.addNativeJarLibs(..)");
86 _USE_TEMP_JAR_CACHE[0] =
false;
89 if( !JNILibrary.loadLibrary(
"jaulib",
false, cl) ) {
90 throw new RuntimeException(
"Couldn't load native tool library with basename <jaulib>");
92 if( !JNILibrary.loadLibrary(
"jaulib_jni_jni",
false, cl) ) {
93 throw new RuntimeException(
"Couldn't load native java library with basename <jaulib_jni_jni>");
95 if( OSType.MACOS == PlatformProps.OS || OSType.IOS == PlatformProps.OS ) {
96 if( !JNILibrary.loadLibrary(
"jaulib_pkg_jni",
false, cl) ) {
97 throw new RuntimeException(
"Couldn't load native MACOS/OS java library with basename <jaulib_pkg_jni>");
100 _libsLoaded[0] =
true;
101 }
catch (
final Throwable t) {
102 System.err.println(
"Caught "+t.getClass().getSimpleName()+
": "+t.getMessage()+
", while loading libs..");
110 initializedID.set(_libsLoaded[0]);
115 MachineDataInfoRuntime.initialize();
120 if(
false == initializedID.get() ) {
121 throw new IllegalStateException(
"Jaulib not initialized.");
125 return false != initializedID.get();
Machine data description for alignment and size onle, see com.jogamp.gluegen.