Tuesday, September 30, 2008

GCJ, MingW and GNU Classpath

GCJ is an open source compiler for Java, part of the GCC compiler set. Whats special about it is that it can also compile Java code into a native executable file which does not require a JRE to be installed to run. This method also speeds up the application. Look here for a complete explanation.

The last time I checked out GCJ was back in 2003. Last month I decided to look it up again as I have a small project that I wanted to develop in Java. Now the application is supposed to be a small utility which will inetract with a Project Management software via websrvices. One of the main requirements is that the utility should load up fast as 40% of the PCs it will be run on are running on Pentium 3. A regular Java app takes ages to load on Pentium 3. GCJ gave me some hope that I might be able to use Java for the app.

I downloaded the latest version of MingW, installed the required iconv binary and compiled a "Hello World" on System.out example. Worked perfect. I moved on to a "Hello World" using a simple Swing frame with label. It compiled successfully, but when I ran the exe file I got an error "AWT Toolkit not found". After a lot of research I found out that although the GCJ developers claim to have merged their code with that of GNU Classpath, since GCJ is part of GCC, they have stayed clear of all GUI code from the codebase. In short GCJ will not allow me to run Swing or AWT apps.

Next I tried to use the regular rt.jar file distributed with Sun JDK to compile the executable as GCJ has an option for choosing the base classes jar file path. The compiler started giving a "... zero-length 'gnu.gcj.gcj-compiled' attribute ..." error. I then understood how GCJ actually works. The GCJ developers have already compiled all their Java base classes into a native library. When creating the exe the compiler links this library to your exe. If I try to use a jar file like the one provided with the Sun JDK or if I recompile GNU Classpath and use it with GCJ, the compiler will first need to compile that jar file into a native library. Although this seems plausible, I really did not have time to try this out.

I also looked into using other Java GUI toolkits. First I went with Thinlet and lwvcl but then I realized that they are based on AWT and thus will not work. Then I looked into using SWT which is not based on AWT and I came across this page. Here you can download a complete MingW, GCJ and SWT environment that allows you to compile native executables with GUI support for Swing. It uses the SwingWT package which allows you to write Swing code to use SWT. The SwingWT package is not production ready though.

Another possibility is to write the app's GUI in pure SWT. I still have to run some more testing on this. I have successfully compiled a "Hello World" example but am still unable to execute it. I found very good and detailed directions here. Will probably try it again next week.

Saturday, September 27, 2008

Awesome list of Free Photoshop Tutorials

I just came across this really awesome list of photoshop tutorials and just thought I would spend the word:


Some of the samples are given below:

Water Effect:

Water Effect:

Wednesday, September 24, 2008

Free University eLearning from MIT

I just came across MIT Open Courseware which gives away free video, audio lectures to most of the courses that are actually being taught at MIT. They are also giving away course syllabus, handouts and lecture notes as PDF files. All free, under the Commons Public License.

So why should you be interested?? Have you ever been interested in attending the MIT "Introduction to Algorithms" course but could afford it. Now you can attend the course for free, from anywhere in the world. Of course you cannot ask the professor any questions but you can have him repeat the lecture over and over again.

This material is also beneficial for universities who can adapt their curriculum to that of MIT.

The material is not only limited to Computers. They have material from all their departments:

Definitely a good source for those stuck in their working lives not able to attend a university to learn something new.

Monday, September 22, 2008

Transferring posts from Blogsome to Blogger

I was successfully able to transfer all my posts from Blogsome to Blogger using ScribeFire. I will still have to transfer the images. ScribeFire also helped me set the dates of the posts to their original post dates.

Maybe in the future someone can use the scribefire code to automatically transfer posts from one blog site to another painlessly.

All I had to do was Add both my blogs to ScribeFire. Then I would select a post from oldBlog so it would load inside ScribeFire. Then I would select newBlog in the Blogs tab and then click the Publish button. I would select "Publish as new ..." in the popup.

Ok, so it was a manual work but it cut down on at least 3 steps. One thing to note is that the names of both my old and new blog was the same (just in case if someone wanted to use the same procedure).

Sunday, September 21, 2008

My New Blog

After spending ages blogging on blogsome, I realized that using Wordpress was not that essential to me anymore. I will attempt to transfer my blogs from blogsome to blogspot hopefully in the next 1 week and hope to make weekly posts here and keep this blog alive.