Example #1
0
        static void Main(string[] args)
        {
            string        config        = File.ReadAllText("config.json");
            Configuration configuration = Newtonsoft.Json.JsonConvert.DeserializeObject <Configuration>(config, new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            });

            BridgeSetup setup = new BridgeSetup()
            {
                //JavaHome = Directory.GetCurrentDirectory() + "/" + configuration.Jre,
                JavaHome = configuration.Jre,
                Verbose  = true
            };

            foreach (string option in configuration.Options)
            {
                setup.AddJVMOption(option);
            }
            setup.AddAllJarsClassPath(Directory.GetCurrentDirectory() + "/" + configuration.Lib);
            JNIEnv env = Bridge.CreateJVM(setup);

            java.lang.Class clazz = java.lang.Class.forName(configuration.Class);
            env.CallStaticVoidMethod(clazz, clazz.getDeclaredMethod("main", new java.lang.Class[] { java.lang.String._class }).GetMethodId(), new Value[0]);
        }