About

Jadira is the home for Sousan and Chris Pheby's open source projects. These are reusable open source Java modules that provide first class solutions using the most effective current JEE technologies.

Search
Tag Cloud
...
Login
Tuesday
Jan052010

Java Decompiler

Many years ago, JAD, the Java Decompiler was released and caused quite a stir, as it made trivial obtaining readable Java sources from Java class files. The author of JAD resolved not to maintain it however, and as new releases of Java have been made JAD was not updated for interoperability.

Enter the Java Decompiler Project. The project Provides a core decompiler, Eclipse plugin and standalone GUI. The releases are interoperable through all current releases of the Java compiler from 1.1.8 to 1.6.0. 

Monday
Nov162009

Maven: Resource is Platform Dependent

The following error was being emitted by the resources plugin using Maven 2.2.0:

[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!

This warning is a hint to update your pom with an encoding to be used. For example:

<project>
  ...
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    ...
  </properties>
  ...
</project>

This setting is applied across all plugins (in builds of Maven prior to 2.1.0 encoding was required to be set on a per plugin basis).

More details are available here: http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding.

Saturday
Aug082009

Fixing Word 2007 Crashing on 'Save As' and 'Print'

The last few days Word 2007 has been crashing on 'Save As' and 'Print', hanging indefinitely until I kill the process.

The answer is documented in the Microsoft Knowledge Base.

To fix the problem:

  1. Close all Office programs.
  2. Open the Registry Editor and locate the following subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\Data
  3. Back this up.
  4. Delete the 'Data' subkey.

The seeminging intractable problem is solved.

Saturday
Jun272009

Perils of Maven's Implicit Reactor

Maven's '-r' command line switch builds an implicit reactor by recursing through subdirectories of the current working directory.

On the face of it, this is a useful facility, especially valuable when bootstrapping a new project. You do not need to maintain a 'root' pom.xml for a project with explicit modules directives. Instead, you simply use -r and Maven can order and invoke the build for each module within the project.

However, I now avoid over-reliance on the implicit reactor. My reasoning for this stems from the release plugins inability to release atomically across a set of modules using the implicit reactor. Instead each module must be individually released. In large projects this is simply impractical. At least one large shared-source project known to me switched its build from the implicit to an explicit reactor - to facilitate the release process.

Saturday
Jun272009

Eclipse Galileo

Eclipse Galileo is the simultaneous release of Eclipse 3.5 and a bundle of Eclipse projects.

This post updates my previous quick configuration howto for Ganymede, helping to quickly get up and running with the most useful Eclipse plugins. Any suggestions for how this can be improved are appreciated as always. The instructions are for Windows - extrapolate as required. With the original Galileo release, it is currently necessary to use pre-release versions of Spring Source Tools Suite, JBoss Tools and M2Eclipse.

1. Download eclipse-SDK-3.5.2-win32-x86_64.zip for 64-bit Windows, or eclipse-SDK-3.5.2-win32.zip for 32-bit Windows. These can be found via http://download.eclipse.org/eclipse/downloads/

2. Make a folder for Eclipse somewhere called 'Eclipse', and unzip the Eclipse SDK zip file to the parent folder. I typically create c:\Java\Eclipse and unzip to c:\Java

3. Create a shortcut to Eclipse, for example:

C:\Java\Eclipse\eclipse.exe -clean -vm "C:\Java\JSE6\bin" -vmargs -Xmx2048m -XX:MaxPermSize=256m

or, potentially using Server VM / ergonomics:

C:\Java\Eclipse\eclipse.exe -clean -vm "C:\Java\JSE6\bin" -vmargs -server -Dcom.sun.management.jmxremote -Xmx2048m -XX:MaxPermSize=256M -XX:+UseParallelGC -XX:+UseParallelOldGC

(where the ‘vm’ argument points to your appropriate Java runtime with Eclipse - this should be at least version 5.0 and should be 32-bit or 64-bit as appropriate).

NB. Best practice is to point to a JDK rather than a JRE location.

4. Next, search for new features using the Galileo Updates (with "Show the latest version" selected).

Pick the appropriate platform features - you can safely select everything. Typical selection could be Business Intelligence Reporting and Charting, Database Development, Programming Languages, Test and Performance Web XML and Java EE Development.

5. After restarting again, the following update sites can be used to add Mylyn Extras, AspectJ Developer Tools, SvnKit, SubClipse, M2 Eclipse, QuantumDB, PMD, Spring Tools Suite, JBoss Tools, and Log4E:

Mylyn http://download.eclipse.org/tools/mylyn/update/e3.4 (all except C/C++ Development, Mylyn SDK and Mylyn WikiText SDK)
Mylyn Extras http://download.eclipse.org/tools/mylyn/update/extras (except Mylyn Extras SDK)

AJDT http://download.eclipse.org/tools/ajdt/35/update

SvnKit http://eclipse.svnkit.com/1.3.x/
SubClipse http://subclipse.tigris.org/update_1.6.x

Eclipse GEF (GEF, Zest and Draw2d - but not SDKs or Source Features) http://download.eclipse.org/tools/gef/updates/releases/
M2 Eclipse http://m2eclipse.sonatype.org/sites/m2e
QuantumDB http://quantum.sourceforge.net/update-site
Qwickie http://qwickie.googlecode.com/svn/trunk/qwickie.updatesite/

JBoss Tools http://download.jboss.org/jbosstools/updates/stable/galileo/ (only Context and Dependency Injection Tools, Freemarker IDE, Hibernate Tools, JBoss Tools RichFaces, JBossAS Tools, SeamTools, XULRunner).
then restart

PMD http://pmd.sourceforge.net/eclipse (only PMD for Eclipse 3)
Groovy http://dist.springsource.org/release/GRECLIPSE/e3.5/
Eclipse WebTools Platform (Patches, Web Tools Platform (3.1.2), http://download.eclipse.org/webtools/updates
EclipseLink (JPA) http://download.eclipse.org/rt/eclipselink/updates/2.0.1/ NB You may need to download the OSGi distribution zip and manually extract javax.persistence.*.jar files if you cannot install from the update site. This is sufficient for SpringSource Tools Suite to install.
Eclipse Target Management Project (Enabling Features and RSE_Runtime) http://download.eclipse.org/dsdp/tm/updates/

SpringSource Tool Suite http://dist.springsource.com/release/TOOLS/update/e3.5 (select only SpringIDE components)
SpringSource Tool Suite http://dist.springsource.com/release/TOOLS/update/e3.5 (select only dm Server Tools)
SpringSource Tool Suite http://dist.springsource.com/release/TOOLS/update/e3.5 (select all available components). NB Spring Source Tool Suite Package may not install and should be deselected.
then restart

Log4E http://log4e.jayefem.de/update (note that the free version cannot be installed using the update site)
Azzurri Clay http://www.azzurri.co.jp/eclipse/plugins
JavaCC Plugin http://eclipse-javacc.sourceforge.net/
then restart

Apache Directory Studio http://directory.apache.org/studio/update/1.x

TestNG http://beust.com/eclipse

6. Other interesting plugins you might want to consider could include:

Checkstyle http://eclipse-cs.sourceforge.net/update/
LuntClipse http://sourceforge.net/project/showfiles.php?group_id=113344&package_id=163970
LogWatcher http://graysky.sourceforge.net/
Color Editor http://www.gstaff.org/colorEditor/download.html

7. A couple of plugins are best installed by hand:

Download Jar Class Finder version 2.1.0 from http://www.alphaworks.ibm.com/tech/jarclassfinder/download and copy the Jar to the Eclipse/dropins/plugins subdirectory.
Download Tarlog Plugin 1.4.0 from http://code.google.com/p/tarlog-plugins/ (I used tarlog.eclipse.plugins_1.4.0.jar) and copy the Jar to the Eclipse/dropins/plugins subdirectory.
Download Bnd from http://www.aqute.biz/Code/Download and copy the Jar to the Eclipse/dropins/plugins subdirectory.

8. Configure eclipse.ini, for example, with the following:

-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xms40m
-Xmx1536m