Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: Game VB.NET
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)
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 18-Dec-12 6:10am
Edited 18-Dec-12 6:12am
Adam R Harris at 18-Dec-12 12:14pm
Maybe you're missing a / or a \ after LaunchFolder and before Minecraft.exe
Richard MacCutchan at 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 at 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.
ryanb31 at 18-Dec-12 16:41pm
Since your paths have spaces you may need "" around the whole thing.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

What is the output if you concatenate the filename string into a variable? does it point to the executable?
Code Master38 at 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 at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 746
1 OriginalGriff 345
2 Magic Wonder 131
3 Kishore Pogaru 130
4 Fredrik Bornander 130
0 OriginalGriff 5,705
1 Sergey Alexandrovich Kryukov 4,763
2 CPallini 4,570
3 George Jonsson 3,142
4 Gihan Liyanage 2,450

Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 19 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100