I'm trying to launch a .jar file using VB.NET after asking the user where their file is. All seems to work but when I confirm the file dialog I get an error basically saying the file could not be found. Here's my code:
Class MainWindow
Dim ServerDir As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
Dim fd As OpenFileDialog = New OpenFileDialog()
fd.Title = "Select Server JAR"
fd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.Desktop
fd.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
fd.FilterIndex = 0
If fd.ShowDialog = Windows.Forms.DialogResult.OK Then
ServerDir = fd.FileName
End If
Call LaunchServer()
End Sub
Private Sub LaunchServer()
Try
Process.Start("java -Xmx1024M -Xms1024M -jar" & ServerDir)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
Any suggestions?