-
Notifications
You must be signed in to change notification settings - Fork 16
Installation manual
To use RJDemetra
you need Java 8 or higher. If you don't (or if your R session is wrongly configure) you will have an error loading RJDemetra
since release 0.1.3.
To check which version Java version is used you can run the following code:
library(rJava)
.jinit()
.jcall("java/lang/System", "S", "getProperty", "java.runtime.version")
If you have Java 7 or lower and you can't update it (for example for security reasons) you can install a portable version of Java. There are several websites where you can download a portable version of Java, for example:
If you use a 64-bit of R be sure to install a 64-bit version of Java.
When the portable version is installed and unzip, you just need to use configure the environment variable JAVA_HOME
before loading RJDemetra
or rJava
.
Thus, if you already have loaded RJDemetra
or rJava
, you have to restart your R session.
Suppose Java is installed in D:/Programs/jdk-21
, you have several solution:
-
Configure the
JAVA_HOME
variable in your script (to be done each time you open R):Sys.setenv(JAVA_HOME='D:/Programs/jdk-21')
And to check the value of the environment variable:
Sys.getenv("JAVA_HOME")
-
Configure globally the
JAVA_HOME
variable (to be done once):a. Modify the
JAVA_HOME
in OS environment variables (in Windows, see for example https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html).b. If you use RStudio, modify the
.Renviron
: from R run the codefile.edit("~/.Renviron")
, add to the file the path to the portable version of Java as before (JAVA_HOME='D:/Programs/jdk-21'
), save and run R again.
If you use a portable version and still have trouble installing the package you can try with the argument INSTALL_opts = "--no-multiarch"
:
# For CRAN release:
install.packages("RJDemetra", INSTALL_opts = "--no-multiarch")
# For development version:
devtools::install_github("jdemetra/rjdemetra", INSTALL_opts = "--no-multiarch")