Friday, 14 February 2014

Java Issue with LibreOffice Base

Recently I have been mucking around with LibreOffice Base in order to enhance my personal knowledge on database structures and also using SQL with a different database engine other than PGSQL or EDB.

For those wondering what LibreOffice first of all is. LibreOffice is a free and open source alternative to Microsoft office, which can run on Windows, Mac OS X, Linux. Before it was called LibreOffice it was previously known as OpenOffice. When Oracle bought over Sun Microsystems, who primarily maintained OpenOffice, many people feared what would happen with their favourite open source office suite and so forked the code. Thus LibreOffice was born back in 2010. LibreOffice offers 6 different modules which are: Write (word processor), Calc (spreadsheet program), Impress (presentation program), Draw (vector graphics editor), Math (program for editing/creating mathematical equations) and Base (database management program).

I quite like the LibreOffice Base as it has a nice simple and easy to understand GUI (graphical user interface). The database engine it uses is known as HyperSQL or HSQLDB, which is a relational database management system written in Java. As it was written in Java though, I ran into a problem.

Originally on my Windows 8.1 machine I was running LibreOffice 3.6 which was a 32-bit install and had no problems running Base. However I installed the latest LibreOffice 4.2 in 64-bit and found the following error appeared when I tried to access my tables in Base.
"LibreOffice Base requires a Java runtime environment (JRE) to perform this task. The selected JRE is defective. Please select another version or install a new JRE and select it under Tools - Options - LibreOffice Base - Connections."
I followed the on screen instructions as the message said and found it did nothing to fix the issue. I un-installed and reinstalled LibreOffice 4.2 and still had the same problem. I rolled back to LibreOffice 4.1.5 and still had problems. I un-installed Java and re-installed this as well and still had issues.

After hunting around for sometime I found what the issue was. I found that Oracle, who now provide and maintain Java, would offer the 32-bit run time environment to install by default. The reason for this is that most browsers run in 32-bit mode. Although Internet Explorer does have a 64-bit mode, this is not used often as many websites are not compatible with it. Oracle does however offer the Java runtime environment in 64-bit mode as well. Before I installed this I thought I would try one more thing. On one forum post I followed the following steps:

  1. Go to Start and then Run
  2. Alternatively press the Windows and R key together
  3. Enter C:\Users\<username>\AppData\Roaming\LibreOffice\4\user\config
  4. Click OK
  5. Locate the file  javasettings_Windows_x86.xml 
  6. Delete this file

After doing this I found that I was once again able to access my tables within LibreOffice Base.