Wednesday, November 19, 2014

OpenOffice Won't recognize Java JRE in windows 7

While playing around with OpenOfficeBase 4.1.1, I have encountered a strange error. "There is no JRE environment." even though latest jre is installed in my system.

Cause:  incompatible JRE version.   
OpenOffice requires 32-bit JRE version

Solution:
----------------
Check the JRE version installed in your system, using the following command:

JAVA -version


The above output clearly indicates that the JRE installed in my system is 64-bit, but OpenOffice requires only 32-bit version.

So, download a 32-bit JRE version from the url (http://www.oracle.com/technetwork/java/javase/downloads/jre6-downloads-1637595.html), install it.

In case there are multiple JRE's installed in your system, and the current JRE loaded is not the one which is being referred by OpenOffice, then this issue may a raise.

To locate a 32-bit JRE in your system, run the following command:

Java -d32

If a 32-bit JRE is available in the system, this command shows us that JRE details.


If there is no 32-bit version of JRE in the system, it shows the error as shown above.

Once, the desired JRE version is installed, Open OpenOfficeBase

Goto Tools -> options -> Java

and try to select the available JRE.

Work Around:
----------------

Open OpenOfficeBase

Goto Tools -> options -> Java

uncheck "use Java run time environment" 

Finding JRE

Linux:

$Which java

gives us the required information about which JRE ( Java Run Time Environment ) is being used by the current session.

Unfortunately, this is not the case for Windows users.

Luckily, I have few commands to know which JRE version is running.

we all know that JAVA -version gives us the version number. 


But, if you have installed multiple JRE's in your system, which JRE is being used by current session? is big question. 

Java -verbose tells us which jar file is being loaded when we executed this command. 

The output would be like this:

Which clearly shows which rt.jar is being used to load java run time. This is path you need to give in any other application which requires jre folder path.

Few applications such as openOffice Base from Apache, are incompatible with 64-bit JRE. 
When in multiple JRE's installed in a system, to check whether there is any 32-bit jre in your system, run the following command: 
Java -d32 

This command searches for any 32-bit jre in the system, if available, it loads it. Otherwise, throws an error as shown below: