Posts Tagged ‘Ubuntu’

What is JAVA_HOME in Ubuntu?

Tuesday, October 21st, 2008

Some Java programs need the environment variable JAVA_HOME, such as Tomcat. In Windows operating system, JAVA_HOME is the directory that the JDK is located. However, in Ubuntu if you install JDK with “sudo apt-get install sun-java6-jdk”, the JDK’s files are extracted to many directories like /usr/bin, /usr/lib, etc. What is JAVA_HOME?

Some people thought it should be /usr because in Windows the Java compiler “javac” is in JAVA_HOMEbinjavac. So in Linux it should be JAVA_HOMEbinjavac and JAVA_HOME=/usr. I don’t think it is the best sulotion. Because I found /usr/bin/javac is not the real Java compiler, it is just a link. I used “ls -l /usr/bin/javac” to see what it links to:

/usr/bin/javac -> /etc/alternatives/javac

And /etc/alternatives/javac is also a link. It links to /usr/lib/jvm/java-6-sun/bin/javac. This is the real Java compiler. And the path is similar to that in Windows. So I think JAVA_HOME should be /usr/lib/jvm/java-6-sun in Ubuntu Linux.

The Keyboard doesn't Work in Virtualbox on Ubuntu 8.04.1

Sunday, October 19th, 2008

I installed Ubuntu Linux 8.04.1 yesterday and removed Windows. But sometimes I need to use Windows, so I have to install VirtualBox.

I used “sudo apt-get install virtualbox-ose virtualbox-ose-modules-generic” to install VirtualBox. Its version is 1.5.6. However, I found a serious problem. My keyboard doesn’t work in VirtualBox. If a virtual machine is running and I click the window, the mouse is captured by the virtual machine. When I press the right Ctrl key the mouse should be released. However, it doesn’t work. I have to press Ctrl+Alt+Backspace to restart X. Some people said that the problem can be solved by disabling support to complex characters. But I need the multi-language support so that this method is unuseful for me.

Finally I found a good solution. I used “sudo apt-get install scim-bridge-client-qt” to install the scim-bridge-client-qt package and reboot my computer. Then the keyboard can work in VirtualBox. Although the solution is very simple, I don’t know why. It may be a bug in Ubuntu 8.04.1.