Switching to Eclipse Win64

June 5th, 2009

Lately I am back to windows world, checking out the newly released Windows 7 RC.
One thing I really wanted to do was to try Eclipse 64bit (given that Eclipse 32 on Windows is already faster than Linux version… Why!!??!!)
Sadly Ganymede distros are not packaged for x86_64, so you have to download a basic Eclipse 3.4.2 SDK build from:

http://download.eclipse.org/eclipse/downloads/

if you click on version number (currently 3.4.2) you will get to the list of builds, download:

eclipse-SDK-3.4.2-win32-x86_64.zip

Of course you will also need a 64bit JVM, I am still with Sun 1.5 JDK 64bit since most of the tools I use aren’t ready yet for 1.6

http://java.sun.com/javase/downloads/index_jdk5.jsp

After setting up the JDK, unzipped eclipse and launched it, go and check eclipse .log file in the workspace and you should find this message:

!MESSAGE Could not load library: localfile_1_0_0.dll. This library provides platform-specific optimizations for certain file system operations. This library is not present on all platforms, so this may not be an error. The resources plug-in will safely fall back to using java.io.File functionality.

After searching a bit I realised that this originates from this bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=203812

In that page there is a link to the file you need:

localfile.dll for win/x86_64

That is the patch (aka 64 bit compiled version of the needed dll). Right click on it, save as localfile_1_0_0.dll and put it into eclipse directory.
The message will disappear and you should be accessing files in full 64bit mode.

Now, the good news is that Eclipse 64bit on windows works! the bad news is that it is naked, no WST, mylyn, svn, nothing! all Ganymede stuff are not there cause we downloaded only the SDK.

Here is the links to get a minimal collection of plugins for a Java / J2EE scenario, but in your case maybe you would want to install Perl or Python or Ruby, the good of eclipse is that it does everything :)

Web Tools Platform (WTP) Project
The update link is http://download.eclipse.org/webtools/updates/ there is a multitude of choices, all filed under “Web Tools Platform 3.0.5”

Subversion plugin Subclipse
For SVN I use Subclipse, I know subversive is the eclipse choice, it is under incubation etc., but subclipse in my opinion is just a little bit better, enough to be my choice (and I can’t be without the nice integration with mylyn that writes my recent tasks whenever I commit).
To install it use this update link:
http://subclipse.tigris.org/update_1.4.x

and install Subclipse, Subversion Client Adapter, Core SVNKit library, JNA library and if you want:
Subversion Revision graph and the integration for Mylyn

Mylyn
It is normally already present in Ganymede but the update link is http://download.eclipse.org/tools/mylyn/update/e3.4 and for the trac integration enable Mylyn extras http://download.eclipse.org/tools/mylyn/update/extras
enable: Focused UI and task list, Mylyn bridge for Eclipse and Java and Mylyn extras the Trac connector

Maven Integration for Eclipse
My choice to use maven in eclipse, update is http://m2eclipse.sonatype.org/update/

Google Plugin for Eclipse
GWT and App Engine, update is http://dl.google.com/eclipse/plugin/3.4

.

Eddy programming , , , ,

Using GWT from source

March 15th, 2009

Using GWT regularly, sometimes, there is the need to verify “what lies beneath” or even to change or expand certain classes.
Programmers contributing to the main gwt source trunk will find this quite trivial, but I usually install tools “as they are”, so this guide should be helpful for those who want to see how to use a complex tool like gwt directly from their favourite IDE (eclipse) in its source code version.

A good starting point is certainly the main developer website

http://code.google.com/p/google-web-toolkit/source/checkout

on this page one can navigate the project clicking on the “browse” button (this works for any project hosted on google code)

Inside the trunk, eclipse sub dir, there is this interesting guide, which I’ll follow step by step, creating my own development environment for GWT:

http://code.google.com/p/google-web-toolkit/source/browse/trunk/eclipse/README.txt

To start, let’s create the directory c:\gwt and check out the trunk and the tools with subversion:

mkdir c:\gwtcd c:\gwt

svn checkout http://google-web-toolkit.googlecode.com/svn/trunk/
svn checkout http://google-web-toolkit.googlecode.com/svn/tools/

As the guide says, all paths are relative to C:\gwt\trunk\eclipse so I will launch eclipse from the command line (later on we can create a batch file for this), also creating a new workspace to keep all of this separated from my other projects

cd c:\gwt\trunk\eclipsec:\eclipse\eclipse.exe –data c:\gwtworkspace

Inside Eclipse:

---------- Required GWT variables ---------
Window->Preferences->General->Workspace->Linked Resources
Create a variable named "GWT_ROOT" pointing to your "trunk" folder.

Window->Preferences->Java->Build Path->Classpath Variables
  Create a variable named "GWT_TOOLS" pointing to your "tools" folder.
  Create a variable named "JDK_HOME" pointing to the root of your JDK install
         (for example, C:\Program Files\jdk1.5.0_05 or /usr/lib/j2sdk1.5-sun) 

------------ Compiler settings ------------
Window->Preferences->Java->Compiler
  Set the compiler compliance level to 1.5.

The following is needed only if you want to run gwt application against the gwt-dev eclipse projects rather than the jar file (in short, only if you want to edit and debug gwt-dev)

Window->Preferences->Run/Debug->String Substitution->New...
  Set the Name to "gwt_devjar".
  Set the Value to c:\gwt\trunk\build\staging\gwt-windows-0.0.0\gwt-dev-windows.jar
  Description can be left blank.

Import GWT in eclipse

  File->Import->General->Existing Projects into Workspace->Next
    Browse to the 'trunk/eclipse' folder and select it
    Deselect All

  Inside this folder are a number of .projects files, only a few of
  which you will need to get started. You may import others later.

    Select 'gwt-dev-windows' and 'gwt-user'
    Select:
      - Hello: very simple project useful as a little playground
      - Showcase: complex UI application
      - DynaTable: uses RPC 

Build GWT with ant (install ant if you don’t have it) to create the “build/staging/…” directories:

cd c:\gwt\trunk\
ant

 

Back in eclipse Run –> Run Configurations you should find the Hello launcher as a Java application (that invokes directly com.google.gwt.dev.HostedMode) were you can start playing around with gwt source code.

This guide is based on the README file in the eclipse directory of the gwt trunk: it is not intended as a substitute for that document that is the main guide of creating a gwt source code – eclipse  environment (especially if you intend contributing to the project).

Other minor eclipse settings that might be useful:

------------ Output Filtering -------------

Window->Preferences->Java->Compiler->Building
Make sure "Filtered Resources" includes ".svn/"

---------- Code style/formatting ----------

Window->Preferences->Java->Code Style->Formatter->Import...
  settings/code-style/gwt-format.xml

----------- Import organization -----------

Window->Preferences->Java->Code Style->Organize Imports->Import...
  settings/code-style/gwt.importorder

Eddy programming , , ,

VirtualBox VM’s on real partitions

February 1st, 2009

I always wanted to give a try to VirtualBox working on a physical partitions, rather than the usual VDI file, mainly to see if there is a performance difference but more importantly because I’d be able to run the hosted operating system on it’s own with a few changes on grub.

Before proceeding I think some warning is needed on what this step-by-step is about.
From VirtualBox user manual:
Warning
Raw hard disk access is for expert users only. Incorrect use or use of an outdated configuration can lead to total loss of data on the physical disk. Most importantly, do not attempt to boot the partition with the currently running host operating system in a guest. This will lead to severe data corruption.

As root add your username to the disk group so that you will have access to partitions:
sudo usermod -a -G disk marty

Now logout and login again or just reboot the system and you should have access to the disk, check if that is true by:

[marty@delorean ~]# VBoxManage internalcommands listpartitions -rawdisk /dev/sda
VirtualBox Command Line Management Interface Version 2.1.2
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0x0c  0   /1  /1   1023/254/63        102406           63
5       0x82  1023/254/63  1023/254/63          4102    209728638
6       0x83  1023/254/63  1023/254/63        112643    218130633
3       0x07  1023/254/63  1023/254/63         86090    448823970

We need to create a fake vmdk file that points VirtualBox to the raw disk:



VBoxManage internalcommands createrawvmdk -filename /home/marty/.VirtualBox/HardDisks/realsda3.vmdk -rawdisk /dev/sda3 -register

Output:

VirtualBox Command Line Management Interface Version 2.1.2
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

RAW host disk access VMDK file /home/marty/.VirtualBox/HardDisks/realsda3.vmdk created successfully.

If everything went like this, you should find a new disk realsda3 in the Virtual Media Manager of xVM.

references:

- the Windows equivalent of this http://www.paulgraydon.co.uk/geeky/nixtricks/virtualbox-win7-centos-on-real-partitions/

- VirtualBox manual http://download.virtualbox.org/virtualbox/2.1.4/UserManual.pdf 9.9. Using a raw host hard disk from a guest

Eddy Sysadmin ,

Xen 3.3.1 compilation on CentOS 5.2 x86_64

January 14th, 2009

Create a directory and cd into it, I usually choose

/usr/local/src/xen-source

mkdir build && cd build
wget http://bits.xensource.com/oss-xen/release/3.3.1/xen-3.3.1.tar.gz
tar xzf xen-3.3.1.tar.gz


Staying in the same directory you will need to pull the kernel with mercurial:

hg clone http://xenbits.xensource.com/linux-2.6.18-xen.hg

(if you don’t have hg installed try this guide)


The final directory layout should look like this:

./build/xen-3.3.1/
./build/linux-2.6.18-xen/


Start!

cd ./build/xen-3.3.1
make prep-kernels



With make prep kernels you will be prompted with new settings of the kernel, just hit enter to keep the default values.


This should be the directory layout (in bold the link to the kernel that was downloaded)

drwxrwsr-x  2 1000 1000  4096 Jan  5 12:26 buildconfigs
drwxr-sr-x  6 root 1000  4096 Jan  9 16:53 build-linux-2.6.18-xen_x86_64
drwxrwsr-x  2 1000 1000  4096 Jan  5 12:26 config
-rw-rw-r--  1 1000 1000  3191 Jan  5 12:40 Config.mk
-rw-rw-r--  1 1000 1000 19399 Jan  5 12:26 COPYING
drwxrwsr-x  7 1000 1000  4096 Jan  5 12:26 docs
drwxrwsr-x  3 1000 1000  4096 Jan  5 12:26 extras
-rwxrwxr-x  1 1000 1000  1161 Jan  5 12:26 install.sh
lrwxrwxrwx  1 root 1000    22 Jan  9 16:52 linux-2.6.18-xen.hg -> ../linux-2.6.18-xen.hg
-rw-rw-r--  1 1000 1000  8177 Jan  5 12:26 Makefile
-rw-rw-r--  1 1000 1000  8962 Jan  5 12:26 README
drwxrwsr-x  6 1000 1000  4096 Jan  5 12:26 stubdom
drwxrwsr-x 33 1000 1000  4096 Jan  5 12:32 tools
drwxrwsr-x  3 1000 1000  4096 Jan  5 12:27 unmodified_drivers
drwxrwsr-x  8 1000 1000  4096 Jan  5 12:27 xen

You can configure the Xen kernel in two ways:



starting from the distro xen .config

yum install kernel-xen-devel

cp /usr/src/kernels/2.6.xx.yy-xen-x86_64/.config ./build-linux-2.6.18-xen_x86_64

creating your own .config from default values

make linux-2.6-xen-config CONFIGMODE=menuconfig

if you get an error about lxdialog not compiling just do yum install ncurses-devel

among all the kernel configuration you will want to change don’t forget to choose the proper CPU architecture and type of machine, in my case:

Preemption Model (No Forced Preemption (Server))

Processor family (AMD-Opteron/Athlon64)

Compile the kernel

make dist KERNELS="linux-2.6-xen linux-2.6-xenU"


this will take time, you can accelerate the building process by adding the

-jX

parameter, where X is the number of jobs to run simultaneously.

To install the kernel files in the /boot directory:

make install KERNELS="linux-2.6-xen linux-2.6-xenU"

…time to make the initrd (adding appropriate –with=aacraid –with=sd_mod etc.)

depmod 2.6.18.8-xen
mkinitrd -v -f /boot/initrd-2.6.18.8-xen.img 2.6.18.8-xen

this is what /boot looks like if everything went good:

-rw-r--r-- 1 root root   62459 Jan 13 11:40 config-2.6.18.8-xen
-rw-r--r-- 1 root root   17497 Jan 13 11:40 config-2.6.18.8-xenU
-rw-r--r-- 1 root root   62400 Dec 16 18:18 config-2.6.18-92.1.22.el5
-rw-r--r-- 1 root root   62395 Jun 11  2008 config-2.6.18-92.el5
drwxr-xr-x 2 root root    1024 Jan 13 10:53 grub
-rw------- 1 root root 3255724 Jan 13 11:41 initrd-2.6.18.8-xen.img
-rw------- 1 root root 3239377 Jan 13 10:25 initrd-2.6.18-92.1.22.el5.img
-rw------- 1 root root 3216199 Jan 13 10:05 initrd-2.6.18-92.el5.img
drwx------ 2 root root   12288 Jan 13 11:01 lost+found
-rw-r--r-- 1 root root   80032 Nov 23  2007 message
-rw-r--r-- 1 root root   92793 Dec 16 18:18 symvers-2.6.18-92.1.22.el5.gz
-rw-r--r-- 1 root root   92749 Jun 11  2008 symvers-2.6.18-92.el5.gz
-rw-r--r-- 1 root root  961829 Jan 13 11:40 System.map-2.6.18.8-xen
-rw-r--r-- 1 root root  655437 Jan 13 11:40 System.map-2.6.18.8-xenU
-rw-r--r-- 1 root root 1163830 Dec 16 18:18 System.map-2.6.18-92.1.22.el5
-rw-r--r-- 1 root root 1162656 Jun 11  2008 System.map-2.6.18-92.el5
-rw-r--r-- 1 root root 1499619 Jan 13 11:40 vmlinuz-2.6.18.8-xen
-rw-r--r-- 1 root root 1355488 Jan 13 11:40 vmlinuz-2.6.18.8-xenU
-rw-r--r-- 1 root root 1861692 Dec 16 18:18 vmlinuz-2.6.18-92.1.22.el5
-rw-r--r-- 1 root root 1859484 Jun 11  2008 vmlinuz-2.6.18-92.el5
-rw-r--r-- 1 root root  458902 Jan 13 11:40 xen-3.3.1.gz
lrwxrwxrwx 1 root root      12 Jan 13 11:40 xen-3.3.gz -> xen-3.3.1.gz
lrwxrwxrwx 1 root root      12 Jan 13 11:40 xen-3.gz -> xen-3.3.1.gz
lrwxrwxrwx 1 root root      12 Jan 13 11:40 xen.gz -> xen-3.3.1.gz
-rw-r--r-- 1 root root 7506786 Jan 13 11:39 xen-syms-3.3.1

now it is the time to add our new kernel to grub:

title Xen 3.3.1 / XenLinux 2.6.18
root (hd0,0)
kernel /xen-3.3.1.gz
module /vmlinuz-2.6.18.8-xen ro root=/dev/VolGroup00/LogVol00
module /initrd-2.6.18.8-xen.img

if you get an error like "No modules available for kernel "2.6.18.8-xenU" after the install just ignore it.

Reboot the machine, if you are working remotely you might want to try something to login again, even if the kernel didn’t work.


if the kernel doesn’t work or you want to try other options just

make uninstall

it will remove all xen kernel files from /boot and also all the settings from /etc (use with caution)

After the reboot you will have to start the xen daemon

/etc/init.d/xend start


and if you want it to start automatically at every boot just:

cd /etc/init.d/
chkconfig --add  xend

additional info

if you get "modules not found" error during xenU boot just

mkdir -p /lib/modules/2.6.18.8-xenU

inside the domain

requirements:

Compiling a linux kernel in general and mostly a xen kernel requires several packages, most of them can be installed with the groupinstall yum option:

yum groupinstall development-tools

and

yum groupinstall "X Software Development"


OpenSSL and other devel packages may also be required, just google any error you might get and you should find the correct package to install:

yum install openssl-devel
yum install glibc-devel

references:

Xen compilation:

http://www.xen.org/download/docs/linux-2.6.18.README.txt

http://lists.xensource.com/archives/html/xen-users/2008-01/msg00699.html

http://www.nikhef.nl/pub/projects/grid/gridwiki/index.php/Xen_on_CentOS_5_-_Notes

Testing a kernel remotely with Grub (didn’t work for me):

http://weichong78.blogspot.com/2007/04/grub-test-kernel-once.html

Yum groupinstall

http://hungrycoder.xenexbd.com/node/468

Eddy Sysadmin, Xen notes , , ,