VirtualBox, Ubuntu and Java

The plan was to get a Java application, using Oracle JDBC, to work running on Ubuntu 7.10 (Gutsy Gibbon) on some Virtual Machine.

Total Time: About one and one half days.
Total Pain: Thee out of five stars.

Chose VirtualBox based on Google research. Probably not scientific but response seemed favored toward VirtualBox – additionally, it's free.

Downloading, installing, and running VirtualBox was easy and intuitive. Didn't need to consult VirtualBox documentation much and there weren't any "gotcha's" requiring additional research.

Commenced installation of Ubuntu...

...then the pain began.

Attempted the install from the mounted LiveCD in VirtualBox.  The only possible screen resolutions available were 800x600 or 640x480.  By default, there were two panels on the top and bottom of the screen in the Ubuntu OS: the top panel resembled a menu and the bottom resembled the Windows TaskBar.

I later came to find the installation wizard contains "Previous" and "Next" buttons. The need to click some navigation button to continue was obvious, I just couldn't see any. It was logical to assume they must be hidden under the bottom panel. I tried to tab and hit the space bar hoping I might get lucky, but numerous attempts failed. I couldn't resize the window, nor could I move the window to make the buttons visible on screen.

A great deal of time was spent attempting to modify the 800x600 to a higher resolution but after many attempts, I simply couldn't get past the 800x600 ordeal.

I tried to resize the bottom panel thinking it might be like the Windows Task Bar, but found the panels can't be resized.

I right-clicked the bottom panel and selected properties. Aha! An Autohide option. Wait. Even better – an Orientation drop down. I changed the top and bottom panels to be on the left and right. Finally, I can see the entire Wizard screen and all its buttons.

I must be overlooking something here, because that part of the installation can't possibly be that asinine. Baring these issues, however, the installation should be relatively quick and painless.

Once the installation was complete, I wish I had started taking notes because it became even trickier as I struggled with the screen resolution. To change the resolution, I discovered you need to modify the file at /etc/X11/xorg.conf. I don't know the first thing about Linux at this point, so I'm ignorant of sudo. If you know Linux and you know what sudo is, you're laughing at me but at the time, I didn't know why I was unable to save the file.

VirtualBoxCouldNotSave

Eventually I discovered how to use sudo and opened the file that way:

    sudo gedit /etc/X11/xorg.conf

I neglected to document the original value, but the value for Driver changed to "vboxvideo".

    Section "Device"
        Identifier    "Generic Video Card"
        Driver        "vboxvideo"
        BusID        "PCI:0:2:0"
    EndSection

After changing the Driver to "vboxvideo", I restarted Ubuntu to see the change take affect. I think I was supposed to change the Input Device section as well before I restarted Ubuntu because somewhere along the process, I lost my mouse. Scratch that. I lost my cursor. This got a bit tricky, but I found that if I held down the left mouse button on the desktop and dragged, I could marquee select, so even without a cursor, I could get some idea where the cursor was based on the outline of the marquee.

Using the marquee select technique, I was just able to open Terminal and then sudo gedit back into the xorg.conf file.

    Section "InputDevice"
        Identifier    "Configured Mouse"
Driver "vboxmouse" Option "CorePointer" Option "Device" "/dev/input/mice" Option "Protocol" "ImPS/2" Option "ZAxisMapping" "4 5" Option "Emulate3Buttons" "true" EndSection

So now I have my mouse working and I have a decent screen resolution. Isn't this FUN?

I'm running the OS, but non-critical, straggling issues remain which I haven't completely resolved yet:

  • Can't change the screen resolution.
    I'm over the 800x600 but I can't change to other resolutions. It appears to just default to the highest resolution. At least I think. I dunno. I got more pressing things to deal with.

  • VirtualBox loses the mounting of shares after a re-boot.
    I previously created a shared folder in VirtualBox and mounted the share in Ubuntu and had it working by copying and accessing a number of files in either direction.

    I thought I mounted the Share in the following way:

        sudo mount -t vboxsf XPShare /home/dstone/XPShare/

    However, now all I receive is the following error:

        mounting failed with error: Protocol error

    I'm not succeeding at getting the Share back and just about everything I can find points me to:

        sudo mount -t vboxsf XPShare /home/dstone/XPShare/

    I can access my Network, however, so I'll just forgo the shared folders for now and access files through the network.

  • This seems a bit odd: Many of the apps don't have a cancel button. When you change an option, for example a background color, icon or font, the change happens immediately and all you can do is close the dialog. You can't make a bunch of changes, change your mind, cancel, and have all your settings revert to their previous values.

Java

Using the previously functioning Shared folder, I copied over a Java application I've been developing and tried to run it.

The Java app is an executable jar so I just tried double-clicking the file as you would in Windows. Instead it opened the file up in Archive Manager. (This didn't work either: Right-Click on the jar file > Properties > Permissions Execute: Allow executing file as program.)

Ok… I don’t have a problem doing it the old fashioned way. Let's just get this thing rolling.

    java –jar HotsosInstaller.jar

At one point or another I had to resolve the following issues:

  • Unable to access jarfile HotsosInstaller.jar
  • Exception in thread "main" java.lang.NoClassDefFoundError:
  • Failed to load Main-Class manifest attribute from HotsosInstaller.jar
  • Exception in thread "main" java.lang.UnsupportedClassVersionError:

java –version reveals that an open source GIJ (GNU Java bytecode interpreter) is installed and NOT Sun’s version.

More research on how to install Sun's version led me to:

    Applications > Add/Remove Applications
    Search for Java Checked Sun Java 5.0 Runtime and Apply Changes

Attempted to run the java application again.

Doh. Forgot my application is utilizing Java 6.0 features.

    Back to Applications > Add/Remove Applications

Could NOT find Java 6.0 Runtime.

More research on how to install Java 6.0:

    sudo aptitude update
    sudo aptitude install sun-java6-bin sun-java6-plugin sun-java6-font
    java –version

Attempted to run the java application again.

Nope... couldn't find the JDBC files... but getting closer....

Changed some library references in Eclipse, rebuilt, re-copied to Ubuntu and drum roll please…

Hurray! The application loads.

Noticed the PNG transparency of the splash screen didn't work, but… the application loaded.

I'm still having troubles making a connection though. This probably has something to do with being on a VM or... who knows... that's another day.

It's unfortunate I didn't take better notes, however, it increasingly became one of those processes you just wanted to get through and move on. I found the issues numerous, nebulous, unfortunate, and many of them just... what's the word? Unnecessary?

3/10/2008 | Comments (1) in Eclipse | Java | Linux/Ubuntu
Email