Use alternatives utility to update JDK

Posted: October 8th, 2011 | Author: | Filed under: java | 2 Comments »

At the prompt, type

sudo update-alternatives --config java

The current available java installs would be displayed

Selection    Command
———————————————–
*  1           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
2           /usr/lib/jvm/jre-1.4.2-gcj/bin/java

To get out of the prompt without make changes, hit Ctrl+C

To add a new jdk, I downloaded the jdk-6u-linux-i586.bin from the Oracle Java site. Unzip it

chmod 755 jdk-6u27-linux-i586.bin
./jdk-6u27-linux-i586.bin

It unzip it to a directory jdk1.6.0_27. I moved it to /usr/lib/jvm,

mv jdk1.6.0_27 /usr/lib/jvm

Then install the jdk1.6.0_27 as a Java alternative. The number 3 is for the priority.

update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_27/bin/java 3

Now if you do “update-alternatives –config java” again, you would see jdk1.6.0_27 got added as a new alternative. Type 3 and hit Enter to select.

Selection    Command
———————————————–
+ 1           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
2           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
3           /usr/lib/jvm/jdk1.6.0_27/bin/java
Enter to keep the current selection[+], or type selection number: 3

Test by typing “java -version”

[root@VM1 ~ ]# java -version
java version “1.6.0_27″
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Client VM (build 20.2-b06, mixed mode, sharing)

 


Create Custom Widgets using InkScape and NetBeans Visual Library

Posted: May 5th, 2010 | Author: | Filed under: java | 3 Comments »

This blog entry shows one how to create a special widget using InkScape and NetBeans Visual Library. This is part of my effort to create a Java-based implementation of MIT’s Scratch, which is implemented in Squeak Smalltalk.

Step 1 Create JScratch Block Graphics:

First I created the image using Inkscape (steps to follow), import the image to IDE, then create two LayerWidgets, one transparent, and another opaque. Add the image to the background LayerWidget, adn the Swing component to the front LayerWidget. Finally, use the BorderFactory.createEmptyBorder function to limit the size of the swing component at the front layer.

To create the Scratch blocks, I used InkScape, the Open Source SVG editor. Here are the steps I took to create the graphic:

Read the rest of this entry »


JScratch Dev

Posted: March 26th, 2010 | Author: | Filed under: java | No Comments »

JScratch Development Notes

This article documents how I set up my development environment for JScratch development. It’s helpful and often crucial for a project’s success to have a detailed documentation on how a development environment is set up.

Read the rest of this entry »