package de.onyxbits.spiralspy; import java.io.*; import javax.swing.*; import com.threerings.opengl.*; import com.threerings.opengl.model.tools.*; import com.threerings.util.*; public class SpyApp implements Runnable { public static void main(String[] args) throws Exception{ new Thread(new SpyApp()).start(); } public void run() { // Are we in the right directory? File test = new File(new File("code"),"projectx-pcode.jar"); if (!test.exists()) { JOptionPane.showMessageDialog(null,"Please put the Jar into the SpiralKnights directory"); System.exit(1); } String psep=System.getProperty("path.separator"); StringBuilder sb = new StringBuilder(System.getProperty("java.home")); sb.append(File.separator); sb.append("bin"); sb.append(File.separator); sb.append("java"); File jvm = new File(sb.toString()); if (! jvm.exists()) { // Guess which OS we are on... sb.append(".exe"); psep=";"; } String ver = Package.getPackage("de.onyxbits.spiralspy").getImplementationVersion(); String cpath="spiralspy-"+ver+".jar"+psep+"code"+File.separator+"lwjgl.jar"+psep+"code"+File.separator+"projectx-config.jar"+psep+"code"+File.separator+"projectx-pcode.jar"+psep+"."; File rsrcdir = new File(new File(System.getProperty("user.dir")),"rsrc"); ResourceUtil.setPreferredResourceDir(rsrcdir.getAbsolutePath()); try { ProcessBuilder builder = new ProcessBuilder(sb.toString(),"-Djava.library.path=native","-cp",cpath,"com.threerings.opengl.model.tools.ModelViewer","rsrc"+File.separator+"character"+File.separator+"pc"+File.separator+"model.dat"); builder.start(); } catch (Exception exp) { exp.printStackTrace(); } } }