Archive for category Java

JD: Amazing Java Decompiler

image

I just found this cool Java Decompiler, JD from Alon Aizenberg’s Tech Blog. It is just a single small exe (682kb) that can open jar files and decompile classes in an instant. The look and feel of the application is close to Eclipse. But it is blazingly fast. There is an Eclipse plugin too. Check it out.

Long time ago I posted about needing a tool like Reflector for Java. I needed a tool that I can use to quickly open a jar and browse the classes in it. JD comes pretty close. It would be perfect if it showed the outline of classes too.

2 Comments

How to find the version a Java class was compiled with?

I wanted to lookup the Java version a class was compiled with. I was getting an error:

java.lang.UnsupportedClassVersionError: (MyClass) bad major version at offset=6

Thanks to StackOverflow I found out the following command I did not know before:

javap -verbose MyClass

The major version tells the Java version used. Here are some example values:

* Java 1.2 uses major version 46
* Java 1.3 uses major version 47
* Java 1.4 uses major version 48
* Java 5 uses major version 49
* Java 6 uses major version 50

I am blogging this for future reference.

No Comments

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.

10 Comments

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.

No Comments

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.

No Comments

Eclipse Tip: Customize menus and toolbars

In Eclipse 3.5 Ganymede it is easier to customize menus and toolbars. Go to Windows>Customize Perspective… to find a newly redesigned UI for customizing individual menu or toolbar items.

I install a lot of plugins for Eclipse. This enhancement lets me keep my perspective clean and tidy.

No Comments

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.

No Comments

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

No Comments

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

No Comments

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.

No Comments