Archive for category eclipse

An Improved RMI Tutorial with Eclipse

Introduction

There are/have-been heaps of remoting frameworks in java, but RMI being part of the JRE/JDK and therefore having no external dependencies is my personal preference for remoting with java. Its main drawback: the wire protocol is not web-friendly and therefore difficult to go through firewalls (although it is possible). But if used behind the firewall, it makes for an excellent way to do distributed computing using only the JDK (OMG! only the JDK?! no Spring? or JMS?!). It does have several killer features that are found in very few (if any) remoting frameworks: callbacks and remote classloading. In this tutorial, you will see remote classloading. Ever since JRE 5.0, you don’t need to compile stubs (meaning you don’t need an extra compile-time step to get RMI working). I am guessing someone decided to do away with those and use the jdk dynamic proxies.

Read the rest of this entry »

How to import java projects with eclipse JDT

During the coding of my Bulk Import Plugin, I had the needs to import java projects into a workspace via code. Via Eclipse’s API to be precise. After reading the code of what happens when you import a project, here is the critical bit of code:

Runnable runnable = new Runnable() {
    public void run() {
    try {
        IPath projectDotProjectFile = new Path(pathToMyProjectDir+ "/.project");
            IProjectDescription projectDescription =
                workspace.loadProjectDescription(projectDotProjectFile);
            IProject project = workspace.getRoot().
                getProject(projectDescription.getName());
            JavaCapabilityConfigurationPage.createProject(project, projectDescription
                .getLocationURI(), progressMonitor);
        }
        catch(CoreException e) {
            e.printStackTrace();
        }
    }
};

// and now get the workbench to do the work
final IWorkbench workbench = PlatformUI.getWorkbench();
workbench.getDisplay().syncExec(runnable);

Eclipse Bulk Import V 1.0

Today I released the V 1.0 of my Eclipse Bulk Import plugin. The source is also available at github.

I created this plugin because at work we have too many eclipse projects (over 200). And sometimes the workspaces get corrupt. Using this plugin, I can save the locations of the current projects in my workspace. And I can also import those projects with one-click. Check out the movie of it in action. This plugin saves me quite a bit of time in creating new workspaces (and then importing over 200 projects), and recovering from corrupted workspaces.

Certified “Works on my machine” :) . If you try it out let me know how it goes.

Using Dropbox for Eclipse Projects

I have a bunch of java projects that I like to work on when I have some free time. Only issue is that this “free time” is from different locations, different computers and different Operating Systems. And since I don’t have a lot of “free time”, its hard for me to setup svn, builds etc. I needed a quicker solution: Dropbox

Of course this wont work out of the box. The trick is to make the eclipse projects self contained. In other words, they must not reference any libs/jars/resources outside their own directory. Most self respecting eclipse users would know how to do this. Then the entire project can be synced with Dropbox.

As my project folders will be synced to anywhere I install Dropbox. All I need is a working eclipse and i can start coding. Yay!