Skip to content

Commit

Permalink
从配置Java到执行mcl命令
Browse files Browse the repository at this point in the history
  • Loading branch information
EricTianC committed Feb 17, 2021
1 parent 1444943 commit 55f5e38
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions checkJRE.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"log"
"os/exec"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -32,7 +33,7 @@ var ARCH = map[string]string{

func checkJRE() {
if checkJavaBin() {
//return
return
}
if whether_download_java_or_not() {
download_java()
Expand Down Expand Up @@ -105,6 +106,6 @@ func download_java() error {
matches, _ := filepath.Glob("./jre/*/bin/*")
javaPath, _ = filepath.Split(matches[0])
}
fmt.Println(javaPath)
log.Printf("已自动配置Java环境,请手动将%s添加到环境变量中", javaPath)
return nil
}
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
package main

import (
"os"
"os/exec"
)

var javaPath string

func main() {
checkJRE()
get_mcl()
cmd := exec.Command(javaPath+JAVA, "-jar", "mcl.jar")
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
_ = cmd.Run()
}

0 comments on commit 55f5e38

Please sign in to comment.