RSS
 

Archive for the ‘Java’ Category

Eclipse Tip: Instance count when debugging

25 Jun

The variable view in Eclipse Helios has a new column called Instance Count. You can view it by selecting the column in Select Columns… option as shown below. A simple solution to understand memory consumption.

 
Comments Off

Posted in Eclipse, Java, Software

 

Eclipse Plugin: StartExplorer

11 May

StartExplorer

When I am working with Eclipse quite a few times I would copy a file’s path or want to open a location in Command Prompt to run some scripts. This is always cumbersome. I have to go to the properties and copy the path, go to command prompt, cd to the location…

StartExplorer is a nice plugin that does all of these and more. The screenshot should say a lot… Options like show resource in explorer, start cmd.exe here topped with keyboard shortcuts. Saves a lot of time for me everyday. You can create custom commands too.

 
 

JD: Amazing Java Decompiler

29 Dec

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

Posted in Java, Software

 

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

16 Nov

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.

 
Comments Off

Posted in Java

 

Portable Eclipse and Portable Java

02 Jul

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

18 Jun

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.

 
Comments Off

Posted in Eclipse, Java, Software

 

Eclipse Tip: Structured Selections

18 Jun

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.
 
Comments Off

Posted in Eclipse, Java, Software

 

Eclipse Tip: Customize menus and toolbars

16 Jun

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.

 
Comments Off

Posted in Eclipse, Java

 

Changing Java AppEngine’s port number

15 Apr

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.

 
Comments Off

Posted in Eclipse, Java, Software, Web

 

Java rides on Google App Engine

08 Apr

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

 
Comments Off

Posted in Eclipse, Java, Software