What is the _working_ command line?
Ain't something like ```java -cp ... -jar DigitalSign.jar org.Sign``` ?

Shivli Srivastava a következőt írta (2024. április 15., hétfő, 13:04:28 
UTC+2):

> 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/bfb58b2d-027b-4304-8602-43da4adaf372n%40googlegroups.com.

Reply via email to