From 405cb8ec1524a5c9daaa2a92d85311525ef29e8d Mon Sep 17 00:00:00 2001 From: James Neale Date: Wed, 27 Jul 2016 20:35:16 +0100 Subject: [PATCH] =?UTF-8?q?Add=20an=20error=20message=20when=20the=20reaso?= =?UTF-8?q?n=20for=20exec=20failing=20is=20that=20JAVA=5FHO=E2=80=A6=20(#4?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- launchlib/launcher.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/launchlib/launcher.go b/launchlib/launcher.go index b1cd4340..5068e9c9 100644 --- a/launchlib/launcher.go +++ b/launchlib/launcher.go @@ -78,11 +78,18 @@ func Launch(staticConfig *StaticLauncherConfig, customConfig *CustomLauncherConf args = append(args, "-classpath", classpath) args = append(args, staticConfig.MainClass) args = append(args, staticConfig.Args...) - fmt.Println("Argument list to Java binary:", args) + fmt.Printf("Argument list to Java binary: %v\n\n", args) + execWithChecks(javaCommand, args) +} + +func execWithChecks(javaExecutable string, args []string) { env := os.Environ() - execErr := syscall.Exec(javaCommand, args, env) + execErr := syscall.Exec(javaExecutable, args, env) if execErr != nil { + if os.IsNotExist(execErr) { + fmt.Println("Java Executable not found at:", javaExecutable) + } panic(execErr) } }