Portable Eclipse and Portable Java

I like portable software. I carry around a bunch of them in my flash drive. I just found out that both Java and Eclipse are available as portable versions at PortableApps.com. The Java version they have is Java 6 update 14 but Eclipse is stuck at 3.4.2.

Eclipse uses portable Java, so Java need not be installed in the PC to run it. Nice. The portable version has some trouble finding the workspace but once you correct the path it works fine.

I updated the Eclipse binaries in to the just released 3.5 and it work great too. Nice way to take Eclipse and your work with you.

Eclipse Tip: Fix your Javadoc

Eclipse’s Java compiler has the ability to process Javadoc comment and validate them. You can set Eclipse to warn about malformed Javadoc comments. Just go to Java > Compiler > Javadoc or Project > Properties > Java Compiler > Javadoc for project specific setting to enable this.

Once enabled you will see warning like below with the ability to Quick Fix (Ctrl + 1) them. Neat.

Eclipse Tip: Structured Selections

Eclipse has a great set of keyboard shortcuts speed things up. Structured Selection shortcuts are a great way to select enclosing identifiers or adjacent statements.

Take the following example. When the cursor is on the variable aFile in the second if statement. Just press Alt+Shift+Arrow Up to quickly select the variable aFile. Press Alt+Shift+Arrow Up again to select aFile.exists(). Likewise the selection can be expanded to aFile.exists() && aFile.isFile() or the entire if statement.




Pressing Alt+Shift+Arrow Down reverses the cycle.

Changing Java AppEngine’s port number

I have been playing around with Google’s Java AppEngine. By default the local development server starts up in port 8080. This kind of messes with my development setup. Every app server I use Weblogic, Tomcat… uses this port by default. To change the port number in eclipse go to Run>Run Configurations…>Web Application><AppEngine Project Name>. In the main tab you can change the port number.

Java AppEngine Port Eclipse.png

If you are running the application from the command line go to <app engine home>/config/user/ant-macros.xml and change the port number in the “dev_appserver” macro attribute.

Java AppEngine Port CL.png

If you are just using the Eclipse plugin for AppEngine the SDK is located at <eclipse home>\plugins\com.google.appengine.eclipse.sdkbundle_1.2.0.v200904062334\appengine-java-sdk-1.2.0.

Java rides on Google App Engine

ae_gwt_java.png

Finally cloud computing comes to Java developers. Dot Net got it with Azure. Now Java has got support from Google in its cloud platform AppEngine.

The great thing about Google’s implantation is that it is not just supporting Java the language but also parts of Java the platform. So Java developers do not have to relearn an entirely new programming stack. Here are the Java standards supported:

  • Java Servlet API
  • Java Server Pages (JSP)
  • Java Data Objects (JDO)
  • Java Persistence API (JPA)
  • javax.cache
  • javax.mail
  • Web Application Archive (WAR)

They also support Eclipse IDE with Google Plugin for Eclipse.

Java AppEngine Project.png

Google is providing an early look at the Java support for the first 10,000 developers. To get access register here. I registered and am waiting for the confirmation email. :-)

Eclipse Tip: Block Selection Mode

Eclipse Tip Block Selection Mode.png

Every once in a while I would open up a source file in Notepad++ to copy/cut text using the block selection mode. Now I can do it from within Eclipse (3.5 M5 and above). The block selection mode can be toggled using the toolbar icon highlighted above or using the shortcut key Alt+Shift+A. Nice addition to the Eclipse editor.

I would have liked it to work just like Notepad++ where I just hold down Alt key and do the selection in block mode but this would work too. :-)

XMind: Mind mapping in Eclipse

XMind.png

Xmind is an Open Source Eclipse based mind mapping tool. It can run as a stand alone application or as a plugin within Eclipse. The application looks good and has a decent set of features. It also lets you upload and share mindmaps on their site.

XMind, combined with online sharing service, provides a revolutionary way to enable both team brainstorming and personal mind mapping. With this major upgrade, we bring Web 2.0 concepts on community sharing into a popular desktop application. New Gantt view allows project managers to easily track project tasks and schedules. You’ll find many more useful and time-saving functions in XMind product family.

Eclipse Tip: Trace method call chains

When reviewing or fixing some old code have you though where is this method called from? Eclipse provides a nice way to find that out. Just go to the method in Java Editor and press Ctrl+Alt+H. Eclipse opens up a Call Hierarchy view that show the method’s call chain.

Members Calling.png

You can also find the trace of the methods being called from the current method. Just use the icons in the view.

Calls From.png

Eclipse Tip: Escape text when pasting

When you paste some text in to a string have you seen this?

pasting string 1.png

The problem is that the string is not escaped. This gives you a error. Fixing this is not easy if you have pasted text that needs a lot of escaping. I have encountered this a few times. It is annoying.

Escape text setting.png

Luckily Eclipse has a simple solution for this. Go to Window>Preference>Java>Editor>Typing and check the “Escape text when pasting into a string literal“. Now when you paste the same text here is what you get:

pasting string 2.png

Nice. What would make this feature more discoverable would be when pasting the string an icon should pop up like in Microsoft Word and provide you an option to paste the escaped string…

paste like word.png