Click here to Skip to main content
15,881,044 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I seem to have a rather interesting problem with my code. Whenever I launch the code with an extra string in front of it such as Launcherfolder + it gives me some memory access error. However when I remove the string from in front of the "Minecraft.exe" it works fine when launching Minecraft.exe.

I need to launch the Minecraft.exe from another folder as you can see, but its not working. So the question is how do I fix this apparently simple problem because the solution escapes me. I think it will launch if minecraft.exe is in the same folder as the Application itself, but as I said I need it to launch from LauncherFolder and not the same directory.

Error: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)

VB
Public Class FrmClientScreen

    Public Property java As Object
 Dim LauncherFolder As String = Application.StartupPath & "\Killerbees Gaming Client\"


    Private Sub btnLogin_Click_1(sender As System.Object, e As System.EventArgs) Handles btnLogin.Click

java = CreateObject("WScript.Shell")
 java.Environment("PROCESS")("APPDATA") = LauncherFolder & "packs\" & CboMinecraftVersion.SelectedItem
 java.Run(LauncherFolder + "Minecraft.exe " + txtUsername.Text + " " + txtPassword.Text)

End sub
End Class
Posted
Updated 18-Dec-12 6:12am
v2
Comments
Adam R Harris 18-Dec-12 12:14pm    
Maybe you're missing a / or a \ after LaunchFolder and before Minecraft.exe
Richard MacCutchan 18-Dec-12 13:48pm    
Where is the Minecraft.exe program actually located? The error message suggests that the path you have created is not the one that leads to this program.
Code Master38 18-Dec-12 15:09pm    
Actually I made sure the file and folder exists. Plus if you actually looked at the code I make adjustments for / in the LauncherFolder string.
ZurdoDev 18-Dec-12 16:41pm    
Since your paths have spaces you may need "" around the whole thing.

1 solution

What is the output if you concatenate the filename string into a variable? does it point to the executable?
 
Share this answer
 
Comments
Code Master38 19-Dec-12 9:19am    
Yes it points to the executable, if you had actually read the comments you would know that the code works when I don't add a variable in front of "Minecraft.exe ". And yes the files exist where there should.
tiggerc 4-Jan-13 5:10am    
maybe you should use & instead of +

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900