-1

私はゲームランチャーに取り組んでいます(はい、すでにありますが、私のものは異なります)。問題は、ログインするとゲームが起動しようとするのですが、コンソール ウィンドウに「jarfile c:\users\max korlaar\dropbox\max にアクセスできません」と表示され、1 ミリ秒後に閉じてしまうことです。私のプロセス引数に指定されたjarファイルがそこにあり、VB.netがその場所で何かをしていると思うので、理由はわかりません。jar ファイルは、私のプログラムに関連するフォルダ Bin にあります。(そして、はい、+ を & に置き換えてみました)

Dim process As New Process
Dim info As New ProcessStartInfo
info.FileName = GetJavaHome() + "\java.exe"
info.CreateNoWindow = True
info.UseShellExecute = True
info.RedirectStandardError = False
info.RedirectStandardOutput = False
Dim args As String = "-jar  -natives{1} -lwjgl{2} -mlcfg{3} -mlmod{4} -j{5} -u{6} -s{7}"
info.Arguments = String.Format(args, My.Application.Info.DirectoryPath + "\bin\natives", My.Application.Info.DirectoryPath + "\bin\natives", My.Application.Info.DirectoryPath + "\bin\lwjgl.jar", My.Application.Info.DirectoryPath + "\config\", My.Application.Info.DirectoryPath + "\mods\", My.Application.Info.DirectoryPath + "\bin\minecraft.jar\", TextBox1.Text, result)
info.Arguments = info.Arguments.Replace("\bin\minecraft.jar", My.Application.Info.DirectoryPath + "\bin\minecraft.jar")
process.StartInfo = info
process.Start()

いくつかの提案を試した後、少し修正して、これを得ました:

    Dim process As New Process
    Dim info As New ProcessStartInfo
    info.FileName = GetJavaHome() + "\java.exe"
    info.CreateNoWindow = False
    info.UseShellExecute = False
    info.RedirectStandardError = False
    info.RedirectStandardOutput = True

    'Got error: Corrupt jar file... Someone with Minecraft Experience can help me to launch it?
    Dim args As String = "-jar ""{6}"" -natives ""{1}"" -lwjgl ""{2}"" -mlcfg ""{3}"" -mlmod ""{4}"" -j ""{5}"" -u ""{6}"" -s ""{7}"""
    ' Got CMD window popping up with error and disappearing
    info.Arguments = String.Format(args, "none", My.Application.Info.DirectoryPath & "\bin\natives\", My.Application.Info.DirectoryPath & "\bin\natives", My.Application.Info.DirectoryPath & "\bin\lwjgl.jar", My.Application.Info.DirectoryPath & "\config\", My.Application.Info.DirectoryPath & "\mods\", "'" & Application.StartupPath & "\bin\minecraft.jar'", TextBox1.Text, result)
    'info.Arguments = info.Arguments.Replace("\bin\minecraft.jar", My.Application.Info.DirectoryPath + "\bin\minecraft.jar")
    process.StartInfo = info
    process.Start()

しかし、今私はエラーを受け取ります: jarfile "{minecraft.jar へのパス (正しいパス)}" にアクセスできません 誰も理由を知っていますか? そして、そのエラーを修正する方法は?

4

1 に答える 1

1

パスにスペースがあるので、それを引用する必要があります (2 の間に入れます")。

Dim args As String = "-jar  -natives""{1}"" -lwjgl""{2}"" ...etc..etc..."

そうしないと、Java 実行可能ファイルは、渡された引数を正しく区別できなくなります。


パスがc:\users\max korlaar\dropbox\max & alexであり、引用符を付けていない場合は、Java 実行ファイルに次のように渡します。

java -jar c:\users\max korlaar\dropbox\max & alex

where のみc:\users\max korlaar\dropbox\maxが to への引数として使用されますjava -jar

したがって、引用符を使用する必要があります。

java -jar "c:\users\max korlaar\dropbox\max & alex"

于 2012-12-12T13:46:54.873 に答える