1 // Copyright 2000-2005 the Contributors, as shown in the revision logs.
2 // Licensed under the Apache Public Source License 2.0 ("the License").
3 // You may not use this file except in compliance with the License.
7 import org.ibex.nestedvm.Runtime;
10 public static void main(String[] args) throws Exception {
12 while(n < args.length && args[n].indexOf("=") != -1) n++;
15 System.err.println("Usage: Env [name=value ...] classname [args ...]");
19 String[] env = new String[n];
20 String[] appArgs = new String[args.length-n-1];
21 for(int i=0;i<n;i++) env[i] = args[i];
22 String className = args[n];
23 for(int i=n+1;i<args.length;i++) appArgs[i-n-1] = args[i];
26 if(className.endsWith(".mips")) {
27 rt = new org.ibex.nestedvm.Interpreter(className);
29 Class c = Class.forName(className);
30 if(!Runtime.class.isAssignableFrom(c)) { System.err.println(className + " isn't a MIPS compiled class"); System.exit(1); }
31 rt = (Runtime) c.newInstance();
33 System.exit(rt.run(appArgs,env));