Saturday, February 12, 2011

Running WPF Designer with Java 6

Today I encountered a perplexing error in the portlet factory designer:

(com/ibm/workplace/wcm/api/Workspace) bad major version at offset=6
Cannot instantiate Class Name: com.dsixe.wcm.Content - java.lang.UnsupportedClassVersionError: (com/ibm/workplace/wcm/api/Workspace) bad major version at offset=6

Now I've seen this type of error before, all it requires is a tweak to the project properties, change the runtime to the appropriate version - in this case it seemed to be 6. But the error would not go away.

The source of the problem was a linked java object builder pointing to a class which contained a reference to a class requiring java 6. When a classname is defined in the builder, I assume it must attempt to introspect the class to determine its methods, and I guess it was unable to instantiate it. So the problem seemed to be that the designer (eclipse) needed to execute in java 6 environment.

Switching to JRE 6

Eclipse start parameters can be defined in a configuration file named C:\IBM\Portlet Factory\Eclipse\eclipse.ini. One of those parameters tells it which JDK to use, so I added the following to the top of the file

-vm
C:\Program Files (x86)\Java\jre6\bin

Then I restarted eclipse. Problem gone.

EDIT 02/05/2013:

Using IBM's J9 JRE
Developers using the publish to websphere portal feature in the WEF designer will need to run the J9 version of java. This can be downloaded from http://www.ibm.com/developerworks/java/jdk/eclipse/ , ensure that you pick the 32 bit version and unzip (I put it in C:\IBM where WEF is installed). For some reason the install of WEF on windows uses 32 bit version of eclipse. Edit the eclipse.ini to use this:

-vm
C:\IBM\IBM_DevelopmentPackage_for_Eclipse_Win_X86_32_4.0.0\eclipseDevelopmentPackage\ibm_sdk70\jre\bin\javaw.exe


Please note that generic comments containing links with the intent of self promotion will be flagged as spam and deleted.

0 comments:

Post a Comment

Are you about to post a generic comment that has nothing to do with this post? Something like "Hey thanks for this very valuable information, BTW here's my website". If so, it will be marked as spam and deleted within 24 hours.

Note: Only a member of this blog may post a comment.