2

I need to integrate Java with R to run some math commands and make plots using features of R. Following part of code is giving error.

    public static void main(String[] args){

            HelloRWorld r = new HelloRWorld();
            r.helloRWorld();
    }

    public void helloRWorld() {

            // using rengine to connect to r
            rengine.eval(String.format("greeting <- '%s'", "Hello R World"));
            REXP result = rengine.eval("greeting");
            System.out.println("Greeting from R: "+ result.asString());
    }

That's the error I'm getting and have no idea about it. Is this something related to JFrames? A fatal error has been detected by the Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006c726036, pid=5360, tid=5956

JRE version: Java(TM) SE Runtime Environment (8.0_11-b12) (build 1.8.0_11-b12) Java VM: Java HotSpot(TM) 64-Bit Server VM (25.11-b03 mixed mode windows-amd64 compressed oops) Problematic frame: C [R.dll+0x26036]

Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

An error report file with more information is saved as: D:\Java\R\hs_err_pid5360.log

If you would like to submit a bug report, please visit: http://bugreport.sun.com/bugreport/crash.jsp The crash happened outside the Java Virtual Machine in native code. See problematic frame for where to report the bug.

Punit
  • 69
  • 1
  • 7
  • I was able to run your code. I guess the error comes somewhere outside the snippet you provided. – nicola Oct 12 '14 at 22:28
  • Thanks for responding @nicola. I'll check it again. – Punit Oct 13 '14 at 20:03
  • 1
    did you set up properly the environment variables of JAVA_HOME, PATH and R_HOME? did you enter through vm options the path to JRI, also did you install in Java all the required JAR files (i don't see any imports in your java code) – Yehoshaphat Schellekens Nov 04 '14 at 13:45
  • @YehoshaphatSchellekens : I was able to execute it. There was another package that needs to installed in R, RUniversal. It worked after that. – Punit Nov 05 '14 at 21:13

0 Answers0