C#以.jar开头以Java错误结束

时间:2017-02-17 12:24:45

标签: java c# minecraft

我正在使用Minecraft Launcher,当我试图用System.Diagnostics.Process打开jar时我卡住了。 继承守守则:

MX Player

它启动Java,然后出现来自Java VM的错误:

    public static void MinecraftStart()
    {
        if (!(Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\natives")))
            Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "\\natives");
        MessageBox.Show("1");
        String args = "-Xmx" + maxG + "G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xms" + minG + "G";
        MessageBox.Show("2");
        string arguments = "-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump " + args + " -Djava.library.path=\"" + AppDomain.CurrentDomain.BaseDirectory + @"\natives"" -cp """;

        foreach (string item in libsList)
            arguments += item + ';';
        arguments += AppDomain.CurrentDomain.BaseDirectory + "version\\" + version + "\\" + version + ".jar\" net.minecraft.client.main.Main --username " + username + " --version " + version + " --gameDir \"" + Application.StartupPath + @""" --assetsDir """ + AppDomain.CurrentDomain.BaseDirectory + "assets\" --assetIndex " + assetsVer + " --accessToken " + accesstoken + " --uuid " + uuid + " --userProperties {}";
        MessageBox.Show("3");
        process = new Process()
        {
            EnableRaisingEvents = true,
            StartInfo = new ProcessStartInfo()
            {
                Arguments = arguments,
                FileName = Launcher.l.metroTextBox1.Text,

                CreateNoWindow = true,
                UseShellExecute = false,
                RedirectStandardError = true,
                RedirectStandardOutput = true
            }
        };
        MessageBox.Show("4");
        process.Start();
        minecraftProcess = process;
        process.BeginErrorReadLine();
        process.BeginOutputReadLine();

        MessageBox.Show("5");
      //  Launcher.l.console.Clear();

        process.OutputDataReceived += process_OutputDataReceived;
        process.Exited += process_Exited;
    }

0 个答案:

没有答案