Please be aware that the following is unsupported feature. This is a small X10 program that will call static main method of specified Java class in place 0. You can use it as follows.
x10 -cp ".:RunJava.jar" RunJava YourJavaClass arg1 arg2 ... -- Mikio 2012/5/22 Rodrique Djonkou <djon...@gmail.com>: > Dear, > > Thanks for the amazing support you provided to me in the past posts. > > I found the joined code in the samples file of the x10_rh6_x86_64 > repositories > (samples/java.interop/RunJava/ RunJava.x10) > > It's seems like it aims to call a class in a jar file and execute it. I'm > not sure ... > Please could you provide me a description of what it does ? > > Below the code ! > > Thanks for your help ! > > Rodrique D. > > import x10.interop.Java; > import x10.interop.java.Throws; > import x10.runtime.impl.java.InteropFuns; > > public class RunJava { > public static def main(args: Array[String](1)) > @Throws[java.lang.Throwable] { > if (args.size < 1) { > Console.ERR.println("Please specify the Java Main class"); > return; > } > > val className = args(0); > val numRestArgs = args.size - 1; > val restArgs = new Array[String](numRestArgs); > Array.copy(args, 1, restArgs, 0, numRestArgs); > val javaArgs = Java.convert(restArgs); > > val mainClass = java.lang.Class.forName(className); > val stringArrayClass = > java.lang.Class.forName("[Ljava.lang.String;"); > val argsClasses = Java.convert([stringArrayClass]); > val javaArgsArray = Java.convert([javaArgs]); > val mainMethod = mainClass.getMethod("main", argsClasses); > > InteropFuns.invokeAndUnwrapExceptions(mainMethod, null, > javaArgsArray); > } > } > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > X10-users mailing list > X10-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/x10-users > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users