Archive

Archive for the ‘programming’ Category

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

.

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

programming , , ,