1

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?

Ben
  • 51,770
  • 36
  • 127
  • 149
Tonematrix
  • 11
  • 2
  • Well, then you have a path problem. See other posts -http://stackoverflow.com/questions/8003272/can-process-start-take-the-system-path-into-account – OldProgrammer Jul 20 '13 at 16:01

0 Answers0