Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9000663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:20:20+00:00 2026-06-16T00:20:20+00:00

I try to start a JVM out of a Google Go program that looks

  • 0

I try to start a JVM out of a Google Go program that looks like this:

package main
import "fmt"
import "os"
import "log"
func main() {

var name string
name="\\jrex64\\bin\\java.exe"

var path="-Xbootclasspath: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 args[] string=make([]string,4)
args[0]="-verbose"
args[1]=path;
args[2]="-cp Ganesha_lib\\*"
args[3]="-jar Ganesha.jar"

var attr* os.ProcAttr

proc,err:=os.StartProcess(name,args,attr)
proc.Wait();


if err!=nil {
    fmt.Println("an error occurred.\n")
    log.Fatal(err)
}

}

It’s my first Go program. And i’m totally overwhelmed by getting the following error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x4278b5]
goroutine 1 [running]:
os.startProcess(0x4aacb4, 0x14, 0xf840001eb0, 0x500000005, 0x0, …)
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/os/exec_posix.go:28 +0x152
os.StartProcess(0x4aacb4, 0x14, 0xf840001eb0, 0x500000005, 0x0, …)
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/os/doc.go:24 +0x5c
main.main()
D:/MyGoProject/src/main.go:60 +0x23c
goroutine 2 [syscall]:
created by runtime.main
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/runtime/proc.c:221
Process finished with exit code 2

How do i have to interpret this error code? What went wrong? And how can i get the JVM startet – it’s situated in a subdirectory of the Go executable file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:20:20+00:00Added an answer on June 16, 2026 at 12:20 am

    It is normally recommended you don’t use os.StartProcess directly. Instead, use os/exec which has a much easier interface. Here is how I would start a java subprocess and wait for it to complete.

    http://play.golang.org/p/APlp9KK9wx

    package main
    
    import (
        "fmt"
        "log"
        "os/exec"
        "strings"
    )
    
    func main() {
        var java = "\\jrex64\\bin\\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\\",
        }
    
        pathflag := "-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)
        }
    
    }
    

    In case you are curious, the reason you got that panic was that attr is a nil pointer. Instead, you could have done attr := new(os.ProcAttr).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when i try to start the rails server this error ever appears C:\Arthur\Ruby\Aplicações em
When i try to start Thread (u) it does nothing! this is what i
I try to start a new fragment from my fragmentActivity, but every time I
I try to start action with service (or activity) from an url. (with params)
When I try to start my MYSQL server on XAMPP and a Mac computer.
When I try to start an IntentService over adb i get tho following error
getting error while try to start service
When I try to start the Sql Server (SqlExpress) service I got the following
When I try to start Firefox using Process.Start and ProcessStartInfo (.NET) everything seems to
When I try to start up a websphere portal server, it hangs at the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.