javarwindowstcprserve

Connect to RServe from JAVA using authentication



Solution

  • As you have enabled the authentification after creating the connection as a first command you need to execute the login command. The Java library has a special wrapper for it.

    See code below for example use case.

    RConnection connection = new RConnection("127.0.0.1",12306);
    connection.login("Admin", "123456");
    REXP x = connection.eval("R.version.string");
    System.out.println(x.asString());
    

    Also, I would recommend using full path as the pwdfile value.