rJava error when running with Eclipse - eclipse

I have installed R 3.0.1 and Eclipse Kepler. (I have installed StatE to run R-script through and Eclipse R-console with no problem.) However, I cannot seem to get a java program to run. I'm posting my issues to see if anyone else has encountered them or can help me understand what I'm doing wrong. After installing R, rJava (through R), and eclipse, I ran the RJavaEclipse Plugin from studytrials.com. Then I configured the paths to the appropriate libraries or .dll.
When I try to run the rtest.java file that comes with the rJava JRI, I get the following error:
Cannot find JRI native library!
Please make sure that the JRI native library is in a directory listed in java.library.path.
java.lang.UnsatisfiedLinkError: no jri in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.rosuda.JRI.Rengine.<clinit>(Rengine.java:19)
at rtest.main(rtest.java:61)
When I try to run via the run tab in eclipse -> run configurations -> R -> rtest, I get a pop-up warning that says:
R_HOME must be set or R properly installed (\Software\R-core\InstallPath registry entry must exist).
So, following the advice that so many on SO give, I tried to find the answer in the warning message.
I found the path information in Eclipse (and Windows) was pointing to the correct locations both in the library and in the R run configuration:
(C:\Users\csnyder\Documents\R\win-library\3.0\rJava\jri\x64;C:\Program Files\Java\jre7\bin\server;C:\Program Files\R\R-3.0.1\bin\x64)
These paths also match the windows environmental paths.
So, I'm at a loss. If anyone has any suggestions on what my issue might be, I would greatly appreciate it. Please comment if you require any additional information.

I had the exact same problem on Linux. In essence, this set up is not updating java.library.path properly and the linkage to the JRI jars fails. I started by printing the path to the console with:
System.out.println(System.getProperty("java.library.path"));
And got this:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
To guarantee that Eclipse updates java.library.path correctly at run time, the Native library location item must be set to the folder containing the JRI jars (/usr/local/lib/R/site-library/rJava/jri in my case):
Just select the item and click Edit... to change its value.

you can try to add the jri.dll(in your rJava/jri/x64 package) on the System environment variable path,like this:(sorry I cann't put the picture on it )
in that way ,then restart your IDE and just run your test.

Related

How to set export Path in ubuntu server?

In ubuntu, I export library path while running my scala application to load the .so files. But the files are not loaded. So an exception occurs when I hit my methods. The exception I get is as follows enter image description here
I don't know how to fix this issue. Lib folder contains all those library files needed but still error appears. Particularly it shows libboost_filesystem cannot be loaded. please help me to fix this issue. Thanks for your help.
You need to make sure your libboost libraries are installed and available for the JVM. There are multiple ways to help JVM find those libraries like LD_LIBRARY_PATH or -Djava.library.path=. Check this article for examples: https://www.chilkatsoft.com/java-loadLibrary-Linux.asp.

"Errors exist in the active configuration..." Eclipse Dialog when Debugging

An "Errors exist in the active configuration of project X. Proceed with launch?" dialog appears while debugging code in Eclipse. Hitting the "Proceed" button results in successful debugging. There are no apparent errors with the launch configuration. A similar Run Configuration does not generate the error.
This is caused by an invalid path somewhere in your Eclipse project settings. There are a couple common sources for this kind of error.
You're working on a shared (version controlled, copied, etc) project where someone has hardcoded a path that doesn't exist on your machine, or uses an environment variable that you've not set.
Sometimes, you can find the offending path by looking at the full list of Error messages. If not, look in your project file.
The Discovery Options in your project properties has 'Automate discovery of paths and symbols' enabled - but the process is generating an error.
If you're using a version of Eclipse that warns you this option is deprecated, uncheck the option to disable it and fix any includes in 'Preprocessor Include Paths' instead. If not. . .try it anyway.
Depending on your path changes, restart Eclipse and try again.
It starts the executable that was built last before you broke the build. That executable will be older then your source files. The reason you were able to debug is because your line numbers did not change for the code you've debugged - e.g. you may try break in main then introduce a compilation error and move main a couple lines below - the debug will highlight the wrong lines when it stops.

Error opening Eclipse

I am unable to open Eclipse IDE. The error displayed is as below
Any idea what could be the reason? And how do I solve this??
Note: I ran CCleaner recently (any registry issue??) and I got error executing my open Eclispe project. On restarting I get this issue. Is re-installation going to help? Am going to do that and update result here. And I would really like to know what caused this for future precautions.
Update: Same error for new installation. But this time got error regarding lauching JVM and missing dlls so going to reinstall Java.
Unable to understand what might be the exact problem , still giving it a shot.
Did you go through this URL http://michaelzanussi.com/?p=468
Appears to be the same issue , resetting JAVA_HOME and PATH solved the issue for him
The authors of Eclipse strongly recommend manually updating the Eclipse.ini file to point directly to the JRE that you want to use rather than relying on Windows environment variables.
Also C:\Windows\System32 is a really strange place to find the Java Runtime Environment files, typically they wind up in C:\Program Files\Java or C:\Program Files (x86)\Java.

Type Conversion to Dalvik format failed: Unable to execute dex: wrapper was not properly loaded first

I have had all sorts of bizarre errors, like the one in the title, happen when I am using the Android SDK and AVD Manager with Eclipse. Generally I just unplug the phone and plug it back in or close and reopen Eclipse but it is frustrating. Apparently Conversion to Dalvik format failed: Unable to execute dex: wrapper was not properly loaded first doesn't allow me to compile my app, i think it is because I was trying to run the emulator with some suggestions from emulator is so slow to no avail. thought i should add im running eclipse 3.5.2 on Ubuntu 11.04
Just restart the eclipse and run the project. The error arises while installing a new target version. After completion of the installation it will get fix automatically. Else restart eclipse.
I met with the same error on my Macbook. I tried one of the methods explained at this link http://techmologies.blogspot.com/2009/05/conversion-to-dalvik-format-failed-with_06.html and solved the problem.
Put the following 2 lines in the eclipse.ini file:
-vm
C:\Program Files\Java\jdk1.6.0_07\bin\javaw.exe
Please modify the 2nd line according to the actual situation.
If you have upgraded your SDK, and if you have not updated ADT plugin it will show this error. Please check it once by updating ADT plugin
I made a new installation of Eclipse in different folder(with the same SDK folder) and imported the code to the workspace & it started to work again.

How does one install 'rj' in StatET plugin for Eclipse?

I have started to try to use StatET and Texlipse with a view to producing SWEAVE reports. When starting the R console in the StatET plug-in for Eclipse (OS X 10.6.4), I get the message:
[INFO] The R package 'rj' is not available, R-StatET tools cannot be initialized.
Information on http://www.walware.de/goto/statet states:
"The package only works in the default R Console (RJ) in StatET. Therefore you have to install and update it using the command line":
R CMD INSTALL --no-test-load rj_*.tar.gz
What does this mean exactly?
In Eclipse under "Install new Software" and the site
WalWare - http://download.walware.de/eclipse-3.6
it states that
RJ Core Library 0.5.0.b201008271600sw
is already installed.
Any helpful guidance gratefully received.
[rant] I also lack the reputation to put my response where it belongs. And there's no button there indicating this. Just a big screen full of nowhere desired to click upon. Negative discoverability sucks. It sucks in Eclipse and it sucks here, too. [/rant]
I'm finding rj frustrating under Ubuntu. On my system, with each major Ubuntu upgrade with a new version of R, I have to go through this procedure over again.
One time I tried to use a tilde (~) character in a path name within some Eclipse configuration field. This failed silently.
My current configuration is as follows. In my ~/.Renviron file:
R_LIBS_USER=~/etc/R/amd64/2.11
Once rJava works, there is an rJava directory here. Just so I don't drive myself insane, in ~/etc/R/README I put a note that my current R configuration is controlled by ~/.Renviron
Somehow at one point I ended up with permission problems where
R CMD javareconf
was failing. Once in frustration I foolishly ran this under sudo to work around this problem, and ended up with permission problems on the generated files. Stupid! The correct fix was to make all the files in /etc/R world readable. Maybe javareconf is only important if you mess with your default Java. Previously, I was running the Sun's JRE. Since 10.10 I'm running icedtea6 and it seems to be working OK. One time it was just the thing to make my configuration work again.
Once I have the right Java binding, from command line R:
install.packages("rJava")
I've had file permission problems running this in the past. I think it was fixed by making all files in /etc/R world readable.
The following is a useful diagnostic to see if this worked, from within any R console:
> system.file("jri",package="rJava")
[1] "/home/allan/etc/R/amd64/2.11/rJava/jri"
If it doesn't look right under Eclipse, there is also some startup debugging available, though it took forever before I noticed this in the docs at StatET.
I created an R Console run configuration for R 2.11 debug In the JRE tab add -Dde.walware.rj.verbose=true. In the Common tab, click Allocate additional Error Log Consoles.
The main configuration options are as follows. Main tab, Launch Type: RJ. R_Config tab, you need to select a Configured R Installation, or create/edit one if you don't have one that works. Mine is Name=R, Location=/usr/lib64/R In the Environment tab I have R_LIBS_USER=/home/USER/etc/R/amd64/2.11 according to how I set things up above. Do not use the tilde (~) character here!
If you end up mucking about with this problem as much as I did, you end up killing a lot of dead consoles. In the Main tab I added the program option --no-save. I don't think this does anything, since I can't end my console by pressing CTRL-D. In the R_Console tab, I added the following R snippet:
q <- function(save = "no", status = 0, runLast = TRUE){
.Internal(quit(save, status, runLast))
#<environment: namespace:base>
}
This gets rid of the annoying "save workspace" prompt when killing an R console with the red square (is that symbolic?) My current workspace also includes a C project, so my R console constantly comes up underneath a blank C-Build console. Annoying as all hell! Haven't solved that yet, but I did discover that from within a StatET code windows the keybinding CTRL-R C pulls the R console to the top.
With my R 2.11 debug configuration I get an extra console titled /usr/lib/jvm/java-6-openjdk/bin/java. You'll have to spelunk the console drop-down to find it. The following is a pertinent snippet of a successful initialization:
CONFIG: JR library path:
/home/allan/etc/R/amd64/2.11
/usr/local/lib64/R/site-library
/usr/lib64/R/library
10-Dec-2010 7:56:47 AM org.rosuda.rj.JRClassLoader addClassPath
FINE: Added '/home/allan/etc/R/amd64/2.11/rJava/java' to classpath of URL loader
A lot more spoo, then finally:
10-Dec-2010 7:56:48 AM de.walware.rj.server.jriImpl.RosudaJRIServer start
INFO: R engine started successfully. New Client-State: 'Connected'.
Looks good, right? But lo and behold in the R console:
[INFO] The R package 'rj' is not available, R-StatET tools cannot be initialized.
Ignore the lying bastard! Turns out my rj is working just fine. No idea why this failure message persists.
Every time around the block with this problem some new amazing piece of gravel ends up in my sneaker.
I don't know whether I've covered everything, but I've written enough for now. Maybe if there are comments I'll come back and fill in the blanks.
Note: found an Eclipse plugin for console switching by keyboard here: Eclipse: Keyboard shortcut for switching between consoles?
It looks like you need to install the RJ library which can be downloaded from the StatET site here: http://download.walware.de/rj/rj_0.5.0-5.tar.gz (more recent versions of RJ can be found at http://www.walware.de/it/downloads/rj.mframe)
If you save that file on your desktop, you can then load it into R with the command they provided R CMD INSTALL --no-test-load rj_*.tar.gz after navigating to your desktop or wherever you saved the library file. Alternatively, you MAY be able to use the GUI interface and select Install packages from local ZIP files under Packages in R, though I haven't used R on a Mac so the layout may be slightly different.
After installing rj with in the R console using
install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.1")
(See http://www.walware.de/?page=/it/statet/troubleshooting.mframe for the correct rj version),
do not forget to update the R_LIBS variable in Eclipse (Windows -> Preferences -> StatET -> Run/Debug -> R Environments -> Edit). To find out the value just type in the R console:
packageDescription("rj").
In my windows 8 installation this returns C:/Users/Fibonacci.PYTHAGORAS/Documents/R/win-library/3.0/rj/Meta/package.rds. The value of R_LIBS I set to
C:/Users/Fibonacci.PYTHAGORAS/Documents/R/win-library/3.0
which is the path where all libraries are installed.
As stated in http://www.walware.de/?page=/it/statet/troubleshooting.mframe newer versions (Versions > 0.5.5) do not need the R CMD INSTALL etc... command.
Here the quite similar I had and the solution I found.
I originally installed Statet using the Eclipse built-in tool "Install new software ...."
I seems it downloaded Statet + rj and that the installation process went well.
After this first installation, I tried to install both packages again. Eclipse refused reading that they already are installed. And, both packages/programs were actually listed in the window of Eclipse.
But, the R console still refused to launch, the dialog box reading that I had to check whether rj was available and that the file paths were correct. Another strange thing was that window explorer had been unable to locate rj on my disk.
???
To solve my whole problem, I simply downloaded rj from http://www.walware.de/ and installed this package via the r console and using the basic install.packages() command.
It now works perfectly .
But, I still don't understand everything ..... :-)
I'd make a comment but I lack the necessary reputation. For Windows, the procedure is the same. There's no zip file. Use the tar.gz. Worked for me. The command, working from the same folder as the downloaded file:
$ G:\R-2.12.0\bin\i386\R.exe CMD INSTALL --no-test-load rj_*.tar.gz
The project is now hosted on GitLab, see
https://gitlab.com/walware/de.walware.rj-server.gr/-/wikis/Installation.
To install:
install.packages(c("rj", "rj.gd"), repos="https://download.walware.de/rj-4.0")
Note that binary packages are available for Windows.
As explained in this message from Stephan Wahlbrink on 2022-02-03 announcing StatET 4.5 release, this version works with R 3.6 to 4.1, and RJ-4.0.
For current information on StatET, check the home page and especially the news.