Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of my employer.

Tuesday, September 2, 2008

Build NetBeans IDE from source : getting started

Building Netbeans IDE from source is considered as the primary task of Netbeans developers. Here I am sharing my experience in working with Netbeans source. I built it on SXDE (solaris express developer edition) 1/08 which is installed in my laptop with 1 GB of physical memory and enough harddisk space. One thing I need to mention first that if you don't have a high speed internet connection the total process will take a lots of time and don't even try it with a dial up connection.

Now the requirements : JDK , Mercurial and Apache Ant.

JDK 1.5 update 13 was already installed in my SXDE 1/08 system.
SUNWmercurial-0.9.5 was also installed in my system.
Apache Ant version 1.6.5 was also there.

I tried to build with the above said configuration but faced lots of problems and finally build failed. So don't try to build if you don't have the following configuration :

JDK 1.5 update 13 is working fine and version 1.6 will not work !

Mercurial 1.0+ is recommended.

Apace Ant 1.7.0+ is also necessary.

If you don't know whether they are already installed in your system or which version is installed , check it first :

You may have multiple instances of jdk installed in your system. In my system version 1.5 and 1.6 both were installed. '/usr/jdk/instances' contained both 1.5 and 1.6 but '/usr/java' was linked to 1.6 . You may check the version of working java by executing '$java -version' , my output was something like :

java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

It's not necessary that the output will be 1.5.0 , just make sure that 1.5 is installed in your system.

Mercurial version can be determined by : '$/usr/bin/hg -v'

first line of the o/p will contain the version name , my o/p was like :

Mercurial Distributed SCM (version 0.9.5)
------------- Many lines omitted --------------

Ant version can be determined in a similar way : '$/usr/sfw/bin/ant -v'

first line of the o/p will contain the version name, mine o/p was like :

Apache Ant version 1.6.5 compiled on November 29 2007
---------------------- Many lines omitted ----------------------

Now I will share how I updated mercurial and ant in my system but before that make sure that .profile file at your home directory doesn't contain '/usr/sfw/bin' as path variable. Otherwise you will get an error during build like : '~/main/nbbuild/build.xml:60: Class org.apache.tools.ant.taskdefs.condition.Not doesn't support the nested "antversion" element' .

I tried to update mercurial to version 1.0.2 . I downloaded it from http://www.selenic.com/mercurial/release/mercurial-1.0.2.tar.gz , extracted to /opt and tried to build it. But 'make' / 'gmake' failed with the same error : 'make: Fatal error in reader: Makefile, line 3: Unexpected end of line seen'. Same thing happened while I tried Mercurial version 1.0.1 (http://www.selenic.com/mercurial/release/mercurial-1.0.1.tar.gz) as well as Mercurial version 1.0 (http://www.selenic.com/mercurial/release/mercurial-1.0.tar.gz ). Finally I installed Mercurial 1.0 from Blastwave repository , by using '#pkg-get install mercurial'. If you don't know how to use pkg-get , Click here. I observed that mercurial-1.0 , Rev = 2008.04.03 was installed during the installation process , Python 2.5.1 and Berkleydb 4.4.20 was also installed as dependancy. After successful installation I checked the version by executing '$/opt/csw/bin/hg -v' and o/p was 1.0 . Then I removed '/usr/bin' from .profile at my home directory to avoid conflict between two hg versions and '/opt/csw/bin' was already added in my path.

Then I updated my ant version to 1.7.1 . I downloaded apache-ant-1.7.1-bin.zip from http://ant.apache.org/bindownload.cgi and extracted it to /opt. Then I added '/opt/apache-ant-1.7.1/bin' to my path :

'PATH=$PATH:/opt/apache-ant-1.7.1/bin'

and defined two environment variables ANT_HOME and JAVA_HOME :

'export ANT_HOME=/opt/apache-ant-1.7.1' &
'export JAVA_HOME=/usr/jdk/jdk1.5.0_13'.

You may check this out by executing '$env'.

Though I removed /usr/bin from my path and added /opt/csw/bin to my path , but '$hg -v' o/p was giving me version 0.9.5 .

Now you need to get a working copy by cloning the Netbeans repository. To do so , I executed :

bash-3.2$ /opt/csw/bin/hg clone http://hg.netbeans.org/main

you may also try main-golden repository which is guaranteed to always build by executing the following :

'bash-3.2$ /opt/csw/bin/hg clone http://hg.netbeans.org/main-golden'

It took a long time to be completed and produced an o/p like :

bash-3.2$ /opt/csw/bin/hg clone http://hg.netbeans.org/main
destination directory: main
requesting all changes
adding changesets
adding manifests
adding file changes
added 99216 changesets with 425778 changes to 94011 files
updating working directory
83779 files updated, 0 files merged, 0 files removed, 0 files unresolved

Now you will find a 'main' directory inside your home directory. If you have write access and want to push changes back you need to edit '~/main/.hg/hgrc' file. Initially it would be something like :

[paths]
default = http://hg.netbeans.org/main

Now edit this file so that it will look like :

[hooks]
pretxncommit.crlf = python:hgext.win32text.forbidcrlf
[ui]
username = username@netbeans.org
[paths]
default = http://hg.netbeans.org/main
default-push = https://username:password@hg.netbeans.org/main/

** Replace username and password with your original username and password.

Now if you have multiple instances of JDK installed in your system you need to mention JDK 1.5 as nbjdk.home. As some modules require additional heap to build, you need to increase javac's, the compiler's, heap size. For these purposes I created a new file '~/main/nbbuild/user.build.properties' and add the following lines:

build.compiler=extJavac
javac.compilerargs=-J-Xmx512m
nbjdk.home=/usr/jdk/instances/jdk1.5.0

Now you are almost done !! Just increase the heap size for ant as the default may not be enough by using a command like :

bash-3.2$ ANT_OPTS=-Xmx512m

Now the final building part :

bash-3.2$cd main
bash-3.2$ant

you must be connected to internet during this part as external binaries would be fetched from a server during first build. You will get an o/p like :

Buildfile: build.xml
clean-cluster-flags:
-jdk-pre-preinit:
-jdk-preinit:
-jdk-warn:
-jdk-presetdef-basic:
-jdk-default:
-jdk-init:
assure-ant:
-load-build-properties: bootstrap:
[mkdir] Created dir: /export/home/ritwik/main/nbbuild/build/antclasses
[javac] Compiling 4 source files to /export/home/ritwik/main/nbbuild/build/antclasses

After that I got a warning like :

[validate-hg-configuration] ======== WARNING ========
[validate-hg-configuration] You seem to be using a version of Mercurial older than 1.0.
[validate-hg-configuration] Please upgrade as your version may have serious bugs fixed in later versions.

Though mercurial 1.0 was installed in my system.

Anyway , build operation was going on smoothly for a long time .... but suddenly build failed due to hash check error in '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external/xmlbeans-2.1.0.zip'. I became confused and deleted all files from '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external' and tried to build again. Then it failed with a 'file not found exception' ... because I deleted the file i.e xmlbeans-2.1.0.zip which the build process was searching . Then I downloaded xmlbeans-2.1.0.zip from http://ftp.wayne.edu/apache/xmlbeans/binaries/ . Place the zipped file in '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external' and tried to build . But it failed again with another file not found error , it was searching for 'xmlpublic.jar' file to copy somewhere in the following path : '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external/xmlbeans-2.1.0/xmlpublic.jar' but it was not there. Then I found that 'xmlpublic.jar' file is present in the following path : '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external/xmlbeans-2.1.0/xmlbeans-2.1.0/lib' with 4 other *.jar files. I copied all 5 jars and paste them in the following directory : '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external/xmlbeans-2.1.0'. Then I tried to build again and this time everything was normal and finally it was successful.

Then I run '/export/home/ritwik/main/nbbuild/netbeans/bin/netbeans' , accept the license agreement and Netbeans IDE 6.5 'development version' was launched .

Everything I have already mentioned happened on yesterday. Today I tried to update my sources . I undergo the following way to pull other people's changes from the server into my repository :

bash-3.2$ hg pull -u
pulling from http://hg.netbeans.org/main

searching for changes
adding changesets
adding manifests
adding file changes
added 309 changesets with 514 changes to 414 files
414 files updated, 0 files merged, 33 files removed, 0 files unresolved

References :

http://wiki.netbeans.org/WorkingWithNetBeansSources

http://wiki.netbeans.org/HgHowTos

http://wiki.netbeans.org/ExternalBinaries

http://wiki.netbeans.org/HgMigration

Monday, September 1, 2008

Star Office 9 Beta : product review

I am trying Star Office 9 Beta on OpenSolaris 2008.05 for last few weeks. It provides some new features which are not currently available in any other office suit. I think this can be considered as a good alternative to MS Office , Adobe Acrobat Professional and Adobe Dreamweaver. I have used Star Office 8 on SXDE 1/08 and observed pretty improvements in this new version.

Download it from http://www.sun.com/software/staroffice/get_beta.jsp and don't forget to check out system requirements and Beta FAQs.

Star Office installation is simple . I have used 'pfexec' command to install it as a normal user. Command line output during installation process was something like :

ritwik@ritwik:~/Desktop$ pfexec ./so-9-beta-bin-solia-en-US.sh

Select the directory in which to save the unpacked files. [/var/tmp/unpack_staroffice]

File is being checked for errors ...
Unpacking ...
All files have been successfully unpacked.
Using /usr/bin/java
java version "1.6.0_04"
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)
Running installer /usr/bin/java -DHOME=/export/home/ritwik -jar JavaSetup.jar
System locale: en_US
Root privileges
OS: SunOS
Mode: installation
Path to packages: /var/tmp/unpack_staroffice/packages/Jar file: /var/tmp/unpack_staroffice/JavaSetup.jar

If you try to install it as a normal user (& without 'pfexec') installation would be failed with the following error message :

Root privileges required for installation!”. After that if you try “ pfexec ./so-9-beta-bin-solia-en-US.sh ” you will get another error message “ Directory /var/tmp/unpack_staroffice already exists. Please select a new directory name.” Actually all files were already unpacked in the said directory viz '/var/tmp/unpack_staroffice' during previous installation process. You can always continue installation in such condition by using this command : $pfexec '/var/tmp/unpack_staroffice/setup'.

After successful installation I created a launcher (right click on ~/Desktop, create launcher) 'Star office 9 Beta' with the command '/opt/staroffice9/program/soffice'. Following screenshots were taken during the installation process :

One thing I need to mention here that star office generated files would be opened by archive manager or previously installed office suit by default. You need to manually change it to open with star office 9 for each type of file for once . Say, if you save a file as *.odt , right click on the file icon, go to properties → Open With → Add and browse to '/opt/staroffice9/program/swriter'.

Star office 9 Beta introduced a lots of impressive features like online update of office suit as well as extensions. MS Office 97 to 2003 generated files are fully accessible in this suit, 'save as' option also provides support for these formats. you would be also able to read MS Office 2007 generated (like *.docx etc.) files. This multiplatform supported office suit (Currently supporting MS Windows including Vista, linux, solaris (sparc & X86), Mac with OS X) provides ODF 1.2 i.e the latest ISO standard. Spreadsheet has been improved with solver tool of calc (access it tools → solver) , spreadsheet and presentation both contains improved insert → chart option. It can import *.pdf files for editing , enhanced security feature is also available for pdf files. Notes in a writer now appearing in the sidebar , they are not only yellow icons anymore. Image cropping and other useful features are available in Drawing wizard.

Database wizard is another beautiful feature of this office suit , creating a new database and opening an existing database file worked fine for me , but I face some problems while tried to connect to an existing database by using following steps :

Connect to an existing database → MySQL → connect using jdbc → Database name and server url , port was given already(3306)→username and checked 'password required' → 'register the database for me' and 'open database for editing' was already checked → save it as a ODF database → a login form appeared asking username and password → after providing all required informations I got an error message like : “Connection to the datasource “Dbname”could not be established, The driver class 'com.mysql.jdbc.Driver' could not be loaded”. I don't know why the driver class is not being loaded. Please leave a comment if you have any idea to solve this issue.

You will find a 'Media Player' under Tools menu. This player is confusing me as it's not being able to play most of the media files I have tried. (Same thing happened on Star Office 8)

During the slide show operation of a Presentation slide transaction is not happening smoothly. I am using Open Solaris 2008.05 with screen resolution 1024X768. I have an intel motherboard 845GVSR with inbuilt graphics chip. May be I am facing a hardware related graphics problem.

The most stunning features are available as add-ons. You must check out available extensions from http://www.sun.com/software/staroffice/extensions.jsp .

Sun PDF Import Extension Beta” allows to import, edit and save a pdf file. Simply download the extension (I downloaded it for solaris x86 platform) : pdfimport.oxt ; go to Tools → Extension manager → Add and browse to the file 'pdfimport.oxt'. After successful installation you would be able to open any pdf document with star office writer and edit as you wish.


Sun Weblog Publisher” allows to publish a post to your web blog directly from star office writer. Download this platform independent extension : 'sun-weblog-publisher.oxt' (mine version was 1.1.0) and add it through extension manager.

Then go to 'options' → 'add' → select your web blog type → give user name and password → ok.


.. and your blog will be added.


In the menubar you will find two buttons viz 'To Weblog...' and 'Open Weblog entry...'. You may also right click somewhere on your document to get 'To Weblog...' , 'Open Weblog entry' is also available under 'File' menu.


Actually this post was published by using this extension , but images were not appearing in my blog. so I was needed to edit it manually later.

Professional Template Pack II – English” provides an option to 'Create stunning, professional documents and presentations with more than 120 templates available for Writer, Calc, and Impress.' After installation browse it from File → new → templates and documents.


Lots of more impressive extensions like “ Sun Presentation Minimizer” , “ Sun Wiki Publisher” are also available.

Be sure to check out all features !!!