I just installed Eclipse on my new computer that’s running windows 8 and I ran into some problems. First I got the following error message:
A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run Eclipse. No Java virtual machine
was found after searching the following locations:
javaw.exe in your current PATH
This was due to the fact that I had actually forgotten to install java which was needed 🙂
I installed java and changed the eclipse ini-file to include the path to the JRE:
I searched the internet and I found out that I had, for some inexplicable reason, installed a 32-bit version of Java on my 64-bit system. Why? Well, it turned out that my browser was a 32-bit version of Chrome and so when I entered java.com and downloaded the installation package they handed me a 32-bit package which I installed. The fact that the path to the JRE included “Program Files(x86)” should probably have been a clue, but no.
I read up and it turned out I had to install both a 32-bit version and a 64-bit version and feed eclipse, which I downloaded as a 64-bit version, the path to the 64-bit JRE installation.
As I’m every now and then trying out new things in Eclipse I found out that’s quite annoying to use any kind of convention that includes prefixing your fields. In C# I always prefix my fields with “m_” so that age becomes m_Age and name becomes m_Name.
The problem with that is that when you use the getter/setter auto generator in Eclipse (right-click on a field and choose Source => Generate getters and setters…) then you end up with getters that are named getm_Age and getm_Name instead of getAge and getName.
Luckily it turns out that you can set your own prefixes in Eclipse by going to Window => Preferences => Java => Code Style and selecting the variable type that you want to edit and add your prefix.
In Visual Studio as well as in other applications I enjoy the MRU tab system (Most Recently Used) which allows me to jump back and forth between two tabs I’m working with instead of simply jumping to the next tab. This can be annoying if you have 5 tabs open but currently only work with tab 2 and 5; you don’t want to jump to the next tab, you want to jump between tab 2 and 5.
This can be done in eclipse as well. The default binding is Ctrl + F6 (Next Editor) and Ctrl + Shift + F6 (Previous Editor). Just go to Window => Preferences => General => Keys and search for F6 or next/previous editor and change the key binding to Ctrl + Tab and Ctrl + Shift + Tab.
As I’m trying to use Eclipse for my PHP development instead of Notepad++ I’m going to have to get some kind of FTP plugin to Eclipse. The Notepadd++ plugin NppFTP is really just a perfect FTP plugin for the application and what I want for Eclipse is basically the same kind of support.
Well, there are two options; the first option is to install the Aptana Plugin (which according to a lot of people ruins your Eclipse installation and is impossible to uninstall) or install the Remote System Explorer End-User Runtime plugin (which is lightweight and does exactly what you want without bloating your install). We’re gonna go with the latter one.
To install the plugin, do the following:
Go to Help => Install New Software
Select your current Eclipse version´s release site (Helios for me)
In the filter textbox enter “remote”
Select the Remote System Explorer End-User Runtime
Click next and run the install (and restart Eclipse)
Go to Window => Open Perspective => Other => Remote System Explorer
Right-click in the perspective and select New => Connection
Click Next and fill in your FTP information
You’ll see your FTP in the Remote System Perspective and if you open up the nodes to your root you’ll be prompted for a FTP login
If you are using Java 7 then you will probably see errors such as this:
This seems to be a Java7 specific error and I keep getting it on one of my computer. The solution is as far as I can tell to downgrade to Java 6 which sucks…
Coming from a C# background I couldn’t quite figure out how to reference projects in the same workspace in Java. In C# ( and Visual Studio) it’s as easy as cake to make a reference to a project in the same solution and I figured it had to work in Java as well. Eclipse turned out to have a feature that handles this and I thought I’d just write it down in case I forget and in case you who are reading this need to know :).
If you have a workspace with a couple of projects representing a layer each in a larger application it might look something like this:
Now, to make a reference to Test.Core in Test.Data (in order to use the Person class) you simply right click on Test.Data and go to Build Path => Configure Build Path and you will see the following window:
Select the projects tab and click the Add button and you should see the next window, select the project to reference and click Ok:
That’s it, now you have a reference to that project! I have yet to figure out where the references are stored and if Eclipse displays them or if you have to go to the output directory to check them out, but there you are. Good luck!
As I’m fiddling with Java on my spare time but C# professionally I wanted my Visual Studio key bindings in Eclipse because I’m a Microsoft imperialist and it is my way or the highway. This was possible, but not completely obvious.
First you have to install the C++ Development SDK (Help => Install new software => C++ => C++ Development Tools) and then you go to Preferences => General => Keys and select Microsoft Visual Studio as Scheme.