Click here to Skip to main content
12,699,022 members (25,006 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB 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 7:10am
Updated 18-Dec-12 7:12am
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.
ryanb31 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 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 19 Dec 2012
Copyright © CodeProject, 1999-2017
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