Click here to Skip to main content
11,704,768 members (51,664 online)
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 658
1 OriginalGriff 485
2 Andy Lanng 275
3 CPallini 242
4 Maciej Los 225
0 OriginalGriff 8,864
1 Sergey Alexandrovich Kryukov 8,245
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,606

Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 19 Dec 2012
Copyright © CodeProject, 1999-2015
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