# Setting up StatET & Eclipse in Windows

May 15, 2012
By

(This article was first published on G-Forge » R, and kindly contributed to R-bloggers)

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”):

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:

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…