Tuesday, June 30, 2015

USB devices not working on my Virtualbox

As I'm now moving to Ubuntu exclusively! but wait I need to do some things to do in Windows. So I had to install Virtualbox and then suddenly I have to connect some USB dongle into my Virtual Windows, but sadly it didn't work.

I did my research on internet, so the problem was easy to solve, just add the user that it's running Virtualbox to the vboxusers group, like this:

$ sudo usermod -G vboxusers -a YOUR_USER

But for some reason, it didn't work until I restarted. Maybe I just only needed to log out and log in back.

Also if you need it, you can list all your USB devices connected to your Ubuntu with this command:

$ lsusb

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 2232:1029
Bus 001 Device 006: ID 0cf3:3004 Atheros Communications, Inc.
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 003 Device 004: ID 04b9:0300 Rainbow Technologies, Inc. SafeNet USB SuperPro
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

References:

Monday, June 29, 2015

Java Class Versions

Last week, I was trying to compile an old code written for JBoss 4.3.2. When I was deploying I got this error message:

Unsupported major.minor version 51.0

But for reference here is the list of class file version with java version:

Java SE 8 = 52
Java SE 7 = 51
Java SE 6 = 50
J2SE 5.0 = 49
J2SE 1.4 = 48
J2SE 1.3 = 47
J2SE 1.2 = 46
JDK 1.1 = 45

The complete error message:

  Bean   : MyClassEJB
  Section: 22.2
  Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the  element.
  Info   : Class not found on 'com.mypackage.ejb.MyClassEJB': Unexpected error during load of: com.mypackage.ejb.MyClassEJB, msg=com//mypackage/ejb/MyClassEJB : Unsupported major.minor version 51.0

The problem was that my Eclipse was running with Java SE 7. And because it was a old project (no maven, nothing modern), all class files were stored in a "bin" directory with version 51.0 (Java SE 7).

Later with an ant script, running with Java SE 6, all files were packaged. But the class obviously were in Java SE 7. That was my issue at deploying time.

Sunday, June 21, 2015

Color Picker for Ubuntu

I'm used have a color picker on my Windows dev machine called Color Cop. But now I found a replacement for my Ubuntu 14.04 called Gpick, so it's very easy to install just do:

 $ sudo apt-get install gpick
Happy coloring your html files.

Saturday, June 20, 2015

How to Install Oracle Java on Ubuntu 14.04

Hi, this is my first post to this blog, I just installed Ubuntu 14.04 LTS. And it has been a great experience. But I will dig more about my install experiences at another time.

Ok let's see how to install Oracle JDK 1.6. Beware that this is Oracle JDK and not Open JDK.
First download jdk1.6 here.

You will get a file like this one: jdk-6u45-linux-x64.bin. Then open a terminal and go to you downloads directory.

1. Give execution privilege to the file:

 $ chmod a+x jdk-6u45-linux-x64.bin
 

2. Run file to extract contents.

 $ ./jdk-6u45-linux-x64.bin
 

3. Move jdk to /usr/lib/jvm

 $ sudo mv jdk1.6.0_45 /usr/lib/jvm
 

4. Create Symbolik Link

 $ sudo ln -s /usr/lib/jvm/jdk1.6.0_45/ /usr/lib/jvm/jdk1.6
 

5. Change group and owner.

 $ sudo chown root:root -R /usr/lib/jvm/jdk1.6.0_45/
 

6. Add variables to global profile, first edit your profile with your favorite editor

 $ sudo vi /etc/profile

Add this at the end:

 export JAVA_HOME=/usr/lib/jvm/jdk1.6
 export JRE_HOME=$JAVA_HOME/jre
 export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

7. (Optional) Create Symbolic Links

 $ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6/bin/java 100
 $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6/bin/javac 100
 $ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6/bin/javaws 100
 

And that's it. You can test your installation with the following commands.

 $ java -version
 $ javac -version
 $ javaws -viewer
 

Update 2015-07-04

Today I followed this guide using JDK 1.5 (jdk-1_5_0_22-linux-amd64.bin) and everything was fine.

Update 2015-07-31

Today I followed this guide using JDK 1.8 (jdk-8u45-linux-x64.tar.gz) and everything was fine. The only difference insetead of running a .bin file you need to run:

 $ tar -xvzf jdk-8u45-linux-x64.tar.gz