command: fork/exec C:/Program Files/Java/jdk1.8.0_131/bin/java: no such file or directory

I am trying to run k6 script for load testing .i am using Docker, k6 influxdb and grafana and using Cygwin to provide Linux environment. we I have already some java function so I am added a new module into k6 and docker build but when I am run it through a script I am getting an error like

command: fork/exec C:/Program Files/Java/jdk1.8.0_131/bin/java: no such file or directory
we use the following code in go language to run a java file

package helloindia

import (
“fmt”
“os/exec”
)

type HELLOINDIA struct{
Name string
Key string}

func (h *HELLOINDIA) display() {
fmt.Println(“hello world”)
h.Name = "Saurabh"
say, err := command(“viney”)
if err != nil {
fmt.Println("command: ", err)
return
}
fmt.Println(say)
h.Key = say
}

func command(name string) (string, error) {
out, err := exec.Command(“C:/Program Files/Java/jdk1.8.0_131/bin/java”, “GenerateOtpValue”).Output()
if err != nil {
return “”, err
}

return string(out), nil

}
const writeWait = 10

func New() *HELLOINDIA {
h := new(HELLOINDIA)
h.Name = “Srivastava”

@Saurabh_Srivastava to me this means that C:/Program Files/Java/jdk1.8.0_131/bin/java is not the correct path to the Java binary. To be on the safe side, you should make sure that the user invoking the Go program has permission to read and execute the Java program.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.