diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2009-07-19 15:56:13 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2009-07-19 15:56:13 +0000 |
commit | 5d63b1b2a6968f9c0146e1946b72ca6073370fbe (patch) | |
tree | d8c9ef35e0f68c95aac11ebd1decd345ba1f82a8 /src/java/com/e1/pdj/PDJSystem.java | |
parent | 0f770551cebca90c92b7a39b0e0135a445af51f9 (diff) |
updated to 0.8.5HEADsvn2git-headexternals/loaders/pdj
svn path=/trunk/externals/loaders/pdj/; revision=11874
Diffstat (limited to 'src/java/com/e1/pdj/PDJSystem.java')
-rw-r--r-- | src/java/com/e1/pdj/PDJSystem.java | 58 |
1 files changed, 18 insertions, 40 deletions
diff --git a/src/java/com/e1/pdj/PDJSystem.java b/src/java/com/e1/pdj/PDJSystem.java index 1fd50d2..ac3fd47 100644 --- a/src/java/com/e1/pdj/PDJSystem.java +++ b/src/java/com/e1/pdj/PDJSystem.java @@ -2,12 +2,10 @@ package com.e1.pdj; import com.cycling74.max.MaxSystem; -import java.awt.Component; -import java.awt.Frame; import java.awt.Toolkit; import java.io.*; - import java.awt.GraphicsEnvironment; + /** * Startup class for pdj. */ @@ -24,7 +22,7 @@ public class PDJSystem { public static void _init_system() { if ( loaded == 1 ) return; - linknative(); + javainit(); initIO(); } @@ -42,49 +40,29 @@ public class PDJSystem { GenericCompiler.rtJar = systemCpJar + ps + "jre" + ps + "lib" + ps + "rt.jar" + File.pathSeparator; } - /** - * Link the Java native classes - */ - static void linknative() { - String pdjHome = System.getProperty("pdj.home"); + static void javainit() { // this is a hack to be sure that statics of MaxSystem are loaded // before everything Class cls = MaxSystem.class; String osname = System.getProperty("os.name"); - - if ( osname.indexOf("Linux") != -1 ) { - // maps PD object as a JVM native library - Runtime.getRuntime().load(pdjHome + "/pdj.pd_linux"); - loaded = 1; - resolvRtJar(); - return; - } - - if ( osname.indexOf("Windows") != -1 ) { - // maps PD object as a JVM native library - Runtime.getRuntime().load(pdjHome + "/pdj.dll"); - loaded = 1; - resolvRtJar(); - return; - } - if ( osname.indexOf("OS X") != -1 ) { - // maps PD object as a JVM native library - Runtime.getRuntime().load(pdjHome + "/pdj.d_fat"); - loaded = 1; - - if ( System.getenv("PDJ_USE_AWT") != null ) { - GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); - Toolkit.getDefaultToolkit(); - } - GenericCompiler.rtJar = "/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar:"; - - return; - } - - System.err.println("pdj: operating system type not found, the native link has not been made"); + try { + if (System.getenv("PDJ_USE_AWT") != null) { + GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); + Toolkit.getDefaultToolkit(); + } + } catch (Error e) { + // on java 1.4, this will throw an error, we simply ignore AWT with 1.4 + } + GenericCompiler.rtJar = "/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar:"; + loaded = 1; + return; + } + + loaded = 1; + resolvRtJar(); } static boolean redirectIO() { |