On Thu, Aug 4, 2022 at 6:24 AM TECHAX <princek...@gmail.com> wrote: > I tried the following one but still, it's not working. > > os.Setenv("PATH","/home/sdk/jdk-11.0.16/bin") > cmd,_:=exec.Command("java","-version").Output() > fmt.Println(string(cmd)) > > Since the path is set, so it should display the java version, right?
Check and share the value of error returned by Command.Output(). Also, try CombinedOutput() instead of Output(). -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA40n-X2Zy7RmWTaK%3DP6H2oqCwb6qcuUg_%2B%3DPBXeEF%3D68bKKMg%40mail.gmail.com.