org.hwo.pulscounter/src/org/hwo/pulscounter/PulsCounter.java

59 lines
1.5 KiB
Java

package org.hwo.pulscounter;
import java.io.File;
import java.lang.reflect.Field;
import org.hwo.os.OsDetect;
import org.hwo.os.OsDetect.OsType;
public class PulsCounter {
public static void main(String args[])
{
File cwd = new File(".");
System.err.println("Starting on OS: " + System.getProperty("os.name"));
System.err.println("Current Directory: " + cwd.getAbsolutePath());
System.err.println("Library Path: " + System.getProperty("java.library.path"));
if (OsDetect.getOperatingSystem() == OsType.LINUX)
{
System.err.println("Linux erkannt. Patche java.library.path");
System.setProperty("java.library.path",String.format(".:%s",System.getProperty("java.library.path")));
Field fieldSysPath;
try {
fieldSysPath = ClassLoader.class.getDeclaredField( "sys_paths" );
fieldSysPath.setAccessible( true );
fieldSysPath.set( null, null );
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchFieldException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.err.println("Library Path: " + System.getProperty("java.library.path"));
}
PulsCounterWindow window = new PulsCounterWindow();
window.setVisible(true);
}
}