Skip to content

Commit

Permalink
Add an error message when the reason for exec failing is that JAVA_HO… (
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesneale authored and uschi2000 committed Jul 27, 2016
1 parent a0bc4dc commit 405cb8e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions launchlib/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit 405cb8e

Please sign in to comment.