我正在研發遊戲啓動器(是的,已經有一個,但我的將不同)。 問題是,如果您登錄,遊戲會嘗試啓動,但我得到一個控制檯窗口,顯示「無法訪問jarfile c:\ users \ max korlaar \ dropbox \ max」,並在1毫秒後關閉。 我不知道爲什麼,因爲我的Process Arguments中給出的jar文件存在,我認爲VB.net會對該位置進行一些操作。 jar文件位於相對於我的程序的文件夾Bin中。 (是的,我試着用&替換+)無法打開Jar文件,使用正確的參數VB
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()
但現在我得到的錯誤:無法訪問jar文件「{minecraft.jar的路徑(正確路徑)}」 有誰知道爲什麼?以及如何解決這個錯誤?
*「煤礦將是不同的」 *除此之外,還有什麼其他區別有哪些? –
您是否嘗試使用您在應用程序中使用的相同命令從應用程序路徑的命令窗口啓動「jar」文件? – sloth
是的,問題是我在jar文件路徑之前和之後添加了一個'。但是現在我從Class中找到了一個很長的錯誤,或者類似的東西 - 也許某個具有Minecraft經驗的人知道 – MaxKorlaar