Home Ask Login Register

Developers Planet

Your answer is one click away!

user1778203 February 2016

executing jar from golanguage program in windows

'package main

import (

func main() {
    //var java = "\\jrex64\\bin\\java.exe"
    var java ="jre/lib/java.exe"

    var path = []string{

    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")


I want to call a jar file from go lang program in windows on window my java is installed in programfiles how do i set up the path for java variable and path variable in windows


Melis February 2016

Well, depending on which version you have of windows there is slightly different methods of setting your PATH and ENVIROMENT variables.

Here you will find guides for most windows versions.

Post Status

Asked in February 2016
Viewed 1,810 times
Voted 4
Answered 1 times


Leave an answer

Quote of the day: live life