Skip to content

Commit

Permalink
Improved error message to R console
Browse files Browse the repository at this point in the history
  • Loading branch information
cande committed Jul 21, 2011
1 parent de36917 commit d4b960f
Showing 1 changed file with 13 additions and 14 deletions.
Expand Up @@ -175,7 +175,7 @@ private void checkRdependencies() throws FileNotFoundException {
if (!runRCmd("R -e \".find.package('rJava')\" -s")) {
logger.debug("Error: Package rJava not found.");
if (!runRCmd("R -e \"install.packages('rJava', repos='http://cran.stat.ucla.edu')\" -s")) {
status = "Error finding and installing rJava, use install.packages('rJava') within R";
status += "Error finding and installing rJava, use install.packages('rJava') within R";
logger.debug("Error: Installation of rJava failed.");
throw new FileNotFoundException(status);
}
Expand All @@ -187,14 +187,23 @@ private void checkRdependencies() throws FileNotFoundException {
} else {
runRCmd("R -e \"installed.packages()['rj','Version']\" -s");
if (!status.contains("0.5.5-4")) {
status = "Wrong 'rj' package installed, please install version 0.5.5-4";
status += "Wrong 'rj' package installed, please install version 0.5.5-4";
logger.debug(status);
runRCmd("R -e \"remove.packages('rj')\" -s");
installRj();
if (runRCmd("R -e \"remove.packages('rj')\" -s"))
installRj();
}
}
}

private boolean installRj() throws FileNotFoundException {
if (!runRCmd("R -e \"install.packages('rj', repos='http://download.walware.de/rj-0.5')\" -s")) {
status += "Error installing rj-package, try manually from: http://www.walware.de/it/downloads/rj.mframe";
logger.debug("Error: Installation of rj failed.");
throw new FileNotFoundException(status);
}
return working;
}

/**
* For some reason or another, on Linux, when booting R with StatET it does
* not see all the same lib paths as when booted from the command line.
Expand Down Expand Up @@ -227,16 +236,6 @@ private String checkUserLibDir() {
return null;
}

private boolean installRj() throws FileNotFoundException {
if (!runRCmd("R -e \"install.packages('rj', repos='http://download.walware.de/rj-0.5')\" -s")) {
status = "Error finding and installing rj-package, try from: http://www.walware.de/it/downloads/rj.mframe";
logger.debug("Error: Installation of rj failed.");
throw new FileNotFoundException(status);
}
return working;
}


// Check if R_HOME is correctly set and tries to correct simple errors.
public String checkR_HOME(String path) throws FileNotFoundException {
Boolean trustRPath = false;
Expand Down

0 comments on commit d4b960f

Please sign in to comment.