'package main
import (
"fmt"
"log"
"os/exec"
"strings"
)
func main() {
//var java = "\\jrex64\\bin\\java.exe"
var java ="jre/lib/java.exe"
var path = []string{
"jrex64\\lib\\rt.jar",
"jrex64\\lib\\jfxrt.jar",
"jrex64\\lib\\resources.jar",
"jrex64\\lib\\ext\\sunjce_provider.jar",
"jrex64\\lib\\ext\\zipfs.jar",
"jrex64\\lib\\ext\\sunmscapi.jar",
"jrex64\\lib\\ext\\sunec.jar",
"jrex64\\lib\\ext\\dnsns.jar",
"jrex64\\lib\\ext\\access-bridge-64.jar",
"jrex64\\lib\\security\\local_policy.jar",
"jrex64\\lib\\jce.jar",
"jrex64\\lib\\jfr.jar",
"jrex64\\lib\\jsse.jar",
"jrex64\\lib\\charsets.jar",
"jrex64\\lib\\",
}
var pathflag string = "-Xbootclasspath:" + strings.Join(path, ";")
cmd := exec.Command(java, "-verbose", pathflag, "-cp Ganesha_lib\\*", "-jar Ganesha.jar")
err := cmd.Run()
if err != nil {
fmt.Println("an error occurred.\n")
log.Fatal(err)
}
}
我想从Windows窗口中的go lang程序调用一个jar文件我的java安装在programfiles中如何在windows中设置java变量和路径变量的路径