package or namespace load failed for 'rJava'

Feb 24, 2015 at 8:57 AM
I've installed the java on my machine and I can run the two below lines in R environment :
__
install.packages('rJava', repos='http://rweb.quant.ku.edu/cran/' ,dep=FALSE)
library(rJava)__

however when I try to use R.Net the second line fails , here is my code:
__
REngine engine = GetEngine();
engine.Evaluate("install.packages('rJava', repos='http://rweb.quant.ku.edu/cran/' ,dep=FALSE)");
engine.Evaluate("library(rJava)");__

here is the exact error message:

__An unhandled exception of type 'RDotNet.EvaluationException' occurred in RDotNet.dll
Additional information: Error: package or namespace load failed for 'rJava'
__
any one knows any solution ?
Feb 24, 2015 at 11:51 AM
I resolved it by re-installing Java !
Marked as answer by Farzad on 2/24/2015 at 3:51 AM
Mar 18, 2015 at 2:10 PM
Edited Mar 24, 2015 at 11:14 AM
I had similar error before. If you have installed both 32bit and 64bit R, you have to find out your R process is 32bit or 64, then install the same version of Java. Then set JAVA_HOME, R_PATH, R_HOME to system path.
Afterwards it works fine for me.