Saturday, July 21, 2012

Eclipse: Clone Remote Systems View Plugin

The RSE Plugin for Eclipse has the Remote Systems View which allows you to look at local file system as well as remote files system using SSH. I use this to view the file system of remote Linux machines from inside my Eclipse IDE on my development machine. This comes very handy for dragging and dropping files between Package Explorer to the remote machine's file system. However if you want to copy files from one remote machine to another it can get tricky because you may have to autoscroll to drag and drop the files due to the long expanded trees shown in the same view. Well, I thought let me just clone the Remote Systems View, place the original and the cloned views side by side, scroll to the right place in the trees in each view and then simply drag and drop  the files. Alas, the Remote System View does not support the cloning. Bummer... No fear....I wrote a small Eclipse Plugin which allows you to do just that. The Clone View feature lets you clone the Remote Systems View as many times as you like. You can further rename each view to your liking, e.g. the name of the remote machine on which you want focus in that view.


Here is the screenshot which shows the original and cloned views focused on different directories on the local file system, but you get the idea:



Get it from the update site here: http://sandipchitaleseclipseplugins.googlecode.com/svn/trunk/CloneViewUpdateSite 
As always feedback welcome. 
Enjoy!  

Thursday, July 19, 2012

Tip: Installing JDK RPM on linux and actaully using it


Oracle puts out JDK updates every now and then. The Linux update comes in the binary form (for install in any directory) and RPM form. I like RPM format because it plugs into OS's standard package installation mechanism. So I downloaded the RPM from here and installed it using:
> chmod u+x jdk-6u31-linux-x64-rpm.bin
> ./jdk-6u31-linux-x64-rpm.bin
:
:
:
and went to command line and typed:
> java -version 
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-48)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Huh? I had presumed that installing the RPM will do the right thing. Uh uh.
Sure enough:
> ls -l /usr/bin/java lrwxrwxrwx 1 root root 22 Apr 13 11:35 /usr/bin/java -> /etc/alternatives/java
> ls -l /etc/alternatives/java lrwxrwxrwx 1 root root 30 Apr 13 14:13 /etc/alternatives/java -> /usr/lib/jvm/jre-1.4.2-gcj/bin/java
revealed that java command was linked to  jre-1.4.2-gcj java.
Apparently you have to run the following commands to make the newly installed  java and javac as available alternatives.
> update-alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_31/bin/java 3000
> update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_31/bin/javac 3000




Now to see what all Java alternatives are available you can run:
> update-alternatives --display java
java - status is manual.
 link currently points to /usr/lib/jvm/jre-1.4.2-gcj/bin/java
/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1420
 slave keytool: /usr/lib/jvm/jre-1.4.2-gcj/bin/keytool
 slave rmiregistry: /usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry
 slave jre_exports: /usr/lib/jvm-exports/jre-1.4.2-gcj
 slave jre: /usr/lib/jvm/jre-1.4.2-gcj
/usr/java/jdk1.6.0_31/bin/java - priority 3000
 slave keytool: (null)
 slave rmiregistry: (null)
 slave jre_exports: (null)
 slave jre: (null)
Current `best' version is /usr/java/jdk1.6.0_31/bin/java.




And finally to select which java to use - use the command:
> update-alternatives --config java
There are 2 programs which provide 'java'.
  Selection    Command
-----------------------------------------------
 + 1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*  2           /usr/java/jdk1.6.0_31/bin/java
Enter to keep the current selection[+], or type selection number: 2 


Select the one from the list and type ENTER. Then do:
> update-alternatives --config javac
:
:

and viola! Now the system will use the Java you selected.
Hope this helps you!

Wednesday, July 04, 2012

Lamps


Here are some
Lamps
I made recently