this is my code func runCommand(ctx context.Context) (string, error) {
if JVMFound(context.Background()) { jarPath := "/Users/shivli.srivastava/Downloads/jars/bcmail-jdk15on-159.jar:" + "/Users/shivli.srivastava/Downloads/jars/bcpkix-jdk15on-155.jar:" + "/Users/shivli.srivastava/Downloads/jars/bcprov-jdk15on-155.jar:" + "/Users/shivli.srivastava/Downloads/jars/xml-apis-1.4.01.jar:" + "/Users/shivli.srivastava/Downloads/jars/xercesImpl-2.12.2.jar:" + "DigitalSign.jar" output, err := exec.Command("java", "-cp", jarPath, "org/Sign"). CombinedOutput() boot.Logger(ctx).Infow("", map[string]interface{}{ "output": string(output), }) //cmd.Env = os.Environ() if err != nil { return "", err } return string(output), nil } return "", cerror.InternalGatewayError.New("").Wrap(fmt.Errorf("JVM Not Found")) } On Monday, April 15, 2024 at 4:32:24 PM UTC+5:30 Shivli Srivastava wrote: > I created a jar where I want to run the main function of the Sign class . > > > *jar tf DigitalSign.jar* > META-INF/MANIFEST.MF > org/ > org/Sign.class > META-INF/ > bcmail-jdk15on-1.59.jar > xml-apis-1.4.01.jar > xercesImpl-2.12.2.jar > bcutil-jdk18on-1.77.jar > bcprov-jdk18on-1.77.jar > bcpkix-jdk15on-1.55.jar > bcprov-jdk15on-1.59.jar > > When I run the command on my terminal , everything works as fine but > running it using exec.Command gives > > *Error: Could not find or load main class org.SignCaused by: > java.lang.ClassNotFoundException: org.Sign . * > What am I missing here ? -- 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/7e99b818-f4fa-40e4-90c5-1b889039ba9fn%40googlegroups.com.