jaroslav@106: /** jaroslav@106: * Back 2 Browser Bytecode Translator jaroslav@106: * Copyright (C) 2012 Jaroslav Tulach jaroslav@106: * jaroslav@106: * This program is free software: you can redistribute it and/or modify jaroslav@106: * it under the terms of the GNU General Public License as published by jaroslav@106: * the Free Software Foundation, version 2 of the License. jaroslav@106: * jaroslav@106: * This program is distributed in the hope that it will be useful, jaroslav@106: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@106: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@106: * GNU General Public License for more details. jaroslav@106: * jaroslav@106: * You should have received a copy of the GNU General Public License jaroslav@106: * along with this program. Look for COPYING file in the top folder. jaroslav@106: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@106: */ jaroslav@29: package org.apidesign.vm4brwsr; jaroslav@29: jaroslav@29: import java.io.BufferedWriter; jaroslav@29: import java.io.FileWriter; jaroslav@29: import java.io.IOException; jaroslav@29: import java.io.Writer; jaroslav@29: jaroslav@136: /** Generator of JavaScript from bytecode of classes on classpath of the VM jaroslav@136: * with a Main method. jaroslav@29: * jaroslav@29: * @author Jaroslav Tulach jaroslav@29: */ jaroslav@136: final class Main { jaroslav@136: private Main() {} jaroslav@29: jaroslav@29: public static void main(String... args) throws IOException { jaroslav@29: if (args.length < 2) { jaroslav@29: System.err.println("Usage: java -cp ... -jar ... java/lang/Class org/your/App ..."); jaroslav@29: return; jaroslav@29: } jaroslav@29: jaroslav@29: Writer w = new BufferedWriter(new FileWriter(args[0])); jtulach@162: StringArray classes = StringArray.asList(args); jtulach@162: classes.delete(0); lubomir@281: try { lubomir@281: GenJS.compile(w, classes); lubomir@281: } finally { lubomir@281: w.close(); lubomir@281: } jaroslav@29: } jaroslav@29: }