Setting up StatET & Eclipse in Windows

A view of the StatET plugin in the Juno Eclipse. The environment is perfect for developing R packages and creating more complex functions.

I wanted to write about creating R-packages in Windows but after trying to get StatET to work seamlessly in Windows I decided that maybe I should start with the very basics. I found Longhow Lam’s excellent PDF about StatET in a Windows environment to be very helpful.

My basic setup:
OS: Windows 7 64-bit
R: 2.15.1 64-bit
Eclipse: Juno (3.8) 64-bit – Eclipse 4.2.0
StatET: 3.1

Eclipse

You can download Eclipse here. I always find the number of different Eclipse versions confusing but I don’t think it matters that much which one you choose. I currently use the Eclipse IDE for JavaScript Web Developers since I do a lot of PHP & JavaScript coding but I think the Eclipse Classic should be enough. Choose 32-bit or 64-bit to match your system, if your unsure what to choose then go with the 32-bit since that will always work.

R

I guess this is overdoing it… but yes you need to also have R installed, you can get it here.

StatET

Use the 3.1 StatET plugin since the old doesn’t support R-2.15 (use http://download.walware.de/eclipse-3.8).

Install StatET by going to Help > Install new software… (yes, it makes absolutely no sense why you put install new software under help but that’s just one of those things you get used to). Enter the address, choose the packages click next/finish on the following boxes (if you can’t click next then click on accept the license and don’t worry about the warning “unsigned content”):

The installation dialog in Eclipse

Sometimes the install process complains about JDK required. Check that you have http://download.eclipse.org/releases/juno in the list of available sites.

If you start up the welcome screen after restarting eclipse (go to the tutorial tab if you’re not there) you can immediately choose “Configure and Launch R Console” and follow the instructions. If you’ve missed that part, go to Window > Preferences (yes, you wouldn’t expect preferences under the windows menu…) and then scroll down to StatET:

R Run dialog

Now choose Add and choose Try find automatically or Browse file system:

I have my R files under: “C:\Program Files\R\R-2.15.1“, the automatic id of the location is “${env_var:PROGRAMFILES}\R\R-2.15.1“. Note that your’s might be somewhere else and the 2.15.0 will probably be different since R frequently updates. Click on the detect environment button:

Now open the Run > Run configurations… (wow, it actually makes sense to find that here although having everything in the same place would be more convenient). Double click on the R Console or select it and click on the New button top left:

Name the new console (not sure this really matters that much), go to the R Config tab and select the R config (I guess the default is the best option). Now click Apply.

Installing the R-packages

Now leave Eclipse and start a regular R session. Install the rj & rj.gd packages from WalWare (hmm… the name makes me think of malware but I guess that’s just me):

install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.1")

Run R console in Eclipse

To start up R you click on the run button in the lower right corner when selecting the console that you’ve previously set up:

Troubleshooting crash on indexing

The first time you start the console you’re asked about indexing the library. I’ve had some trouble here – Eclipse was kept crashing with a “JVM terminated. Exit code = -1″ :-( I finally solved it by removing all Java installations (Go to Windows > Control panel > Programs > Uninstall…) and reinstalling the 64-bit version. If you’ve downloaded the 64-bit version of Eclipse, you can find the Java versions here.

Done!

Hopefully it should work now. At least it does for me :-). I guess setting up in a Linux environment is easier but unfortunately I often find my self in need of using Windows software and therefore it’s more convenient for me to work in Windows.

I will try to get back with some more on configuring the StatET tools.

Update on Windows 8

On my new laptop with Windows 8 and Eclipse Juno 4.2 – I have to run R through Rterm. Not yet figured out what’s missing…

flattr this!

This entry was posted in R, Tutorial. Bookmark the permalink.

12 Responses to Setting up StatET & Eclipse in Windows

  1. Neil says:

    Thanks for creating this guide, it helped me to get set up. The only step I had trouble with was ‘Installing The R-Packages’.

    I had to download the zip of the correct files from Walware’s RJ download page (www.walware.de/it/downloads/rj.mframe) then install them manually from a DOS command prompt. Change directory to your R executable folder (on my machine it’s C:\Program Files\R\R-2.15.2\bin\x64) then run this command:
    R CMD INSTALL –no-test-load “C:\Some path\rj_1.1.0-4.zip”

    Regards

    • Max Gordon says:

      Strange, I’ve never had that problem although I guess there is an endless list of things that can go wrong before you have a fully working set-up. Thanks for figuring it out and sharing!

      By the way, I’ve used WalWare’s instructions that you can find here: http://www.walware.de

  2. Wei says:

    Thank you for the guide. Did you figure out how to run R through RJ in windows 8+eclipse4.2.2? I have the exact same question and couldn’t find a workaround.

    • Max Gordon says:

      Currently I run R through RTerm, it works Ok but isn’t as fast as the rj. If they haven’t fixed the issue when the 3.0 rj arrives I’ll try and send a bug-report to Stephan Wahlbrink. Buying a laptop with Windows 8 is probably the biggest mistake that I’ve ever done – I haven’t found anything that’s better than the previous version :-(

  3. Ani says:

    I’m an amateur at eclipse…I’m getting an error “Show NIControl” has encountered a problem when I try to Run.

  4. vlmath says:

    I had the same probleme with RJ and found the solution. It was the RJ version.
    Go to the StatET website, and check the version to download.
    I’am on Win8, 64bit, Eclipse Luna and it work like a charme.

    Thank’s for your article ;)

  5. joeschmo says:

    My “Run” buttion after R configuration is complete is not highlighted. Is this the problem with RJ libraries? I can only run R Console via Rterm and not RJ.

    thanks,
    JS

    • Max Gordon says:

      I’ve had the same problem. I’ve currently migrated everything to RStudio. It has reached a level of maturity where it can do everything that I previously needed Eclipse for.

      • joeschmo says:

        Actually, I figured out what the problem was. My JRE is 32-bit environment. But, while doing Run Configuration for R, I selected x86_64 option. This prevented Eclipse from running 64-bit R with 32-bit JRE. To get around this, I created another Run Configuration with x86 option and created another console. After this, I was able to run the console both RTerm and RJ.

  6. joeschmo says:

    Has any one been able to figure out how to get remote-R console to run in the Eclipse environment. We would like to run R-console on Linux server so we can utilize powerful machine and that’s where our data resides as well. I have not been able to find any instructions that tell me how to setup remote Rconsoles.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>