Running Eclipse on Ubuntu

Posted by U.S. Wickramasighe | Posted in , , , , | Posted on Tuesday, April 21, 2009

For starters, Running Eclipse IDE under Ubuntu would be a major hedache. You may encounter unusual number of errors including at Start-up , when running plugins , software updating , etc. Though the reason cannot be exactly pointed out , several issues standout among the rest ..First and foremost is the Eclipse SWT (Standard Widget ToolKit). Though a standard java lib ,SWT depends a lot on native platform features in order to provide nicer, richer graphical interface than AWT or Swing .

Therefore SWT library needs to be installed (if not provided ) for each platform you are running in but still may encounter errors (ie:-XPCOM Error , Widert Disposed too early, etc) due to dependencies on web browser ,etc. Eclipse Runtime GCJ would be another reason behind many issues including when running plugins, software updates, java debugging , etc. GCJ is the java compiler + runtime provided by GCC (GCJ v1.5) , which is actually an open-source implementation of java kernel provided with ubuntu , which unfortunately Eclipse picks up as it's default JRE for most Linux platforms.GCJ is not properly tested and not a intended Runtime expected by Eclipse Developers hence would be the origin for a lot of in-compatibilities.

Several work-arounds generally solve all these issues ,

  • set Eclipse java virtual machine to java 1.5 0r 1.6 provided by SUN . This can be set in command line using ./eclipse -vm /${path to JDK Home}/bin/java or in eclipse.ini file specifying
    -vm
    /${path to JDK Home}/bin/java
  • if a Startup problem is there try updating Ubuntu or install latest xulrunner and XPCOM (sudo apt-get install xulrunner) packages for ubuntu and append to eclipse.ini
    -Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner/xulrunner

Using Maven2 (Contd..)

Posted by U.S. Wickramasighe | Posted in , , , | Posted on Friday, April 03, 2009

Maven2 has very easy to use API for building Source code..I find it very easy to work with Maven2 due to this factor. Basic command for building is 'mvn install' but it's almost always a good idea to build using 'mvn clean install' since it does cleanup of already built code and then starts building fresh..
Before building always make sure your source code resides in '/src/main/java' and resources resides in '/src/main resources' . This is the default behavior for Maven2 and you can always modify it in super 'Pom' (or in you project pom as well ) which is the default root pom for all the pom's for Maven2.

commands

mvn clean install -> compile source and do necessary packaging

mvn compile -> compile and run

options

-Dmaven.test.skip=true -> Sometimes it's better to skip unit tests and test cases , since it will be taking lot of time

-o -> offline building . it's better to use this option if you know necessary plugins and dependencies are residing locally and upto date. Buiding with this option will take much less time since no downloading would occur from remote repositories.

-U -> if maven displays an error of unavailable/error in a plugin use this option. this will force Maven to download the plugin and resume the life cycle


Notes

Please note that if you are building a hudge tree of source code , maven will require a lot of memory to keep it's persistant data. So if the memory limit exceeds Maven2 build proccess will be terminated with out of memory error. So always make sure to set 'Xmx' Memory for Maven to a higher value in these scenarios..

  • open ${Maven_Home}/bin/mvn shell script file... (in Windows mvn.bat)
  • Put set MAVEN_OPTS='-Xmx=1024m' at the start of the script file. Here 1024m can be replaced by any value you desire and only limited by the physical memory of your machine (should be a large value for aforementioned scenario)
For more information on Maven and it's build process go to http://maven.apache.org/
------------------------------------------------------------------------------
My previous post Using maven2 part1