Issue 111555 - SDK: Mac OS 10.6: Java examples do not run
SDK: Mac OS 10.6: Java examples do not run
Status: RESOLVED FIXED
Product: App Dev
Classification: Unclassified
Component: sdk
OOo 3.3 or older
All Mac OSX, all
: P3 trivial
: 4.0.0
Assigned To: AOO issues mailing list
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-12 12:43 UTC by kai.sommerfeld
Modified: 2013-07-21 10:08 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description kai.sommerfeld 2010-05-12 12:43:01 UTC
Mac OS 10.6 (Snow Leopard) comes with a 64 bit JRE (this is different from
previous Mac OS X versions). Thus, invocation of "java" by default initializes a
64 bit JRE. Any native library used by this environment must be 64 bit. Java UNO
simple bootstrap uses a pipe urp connection, which relies on the native URE
library libjpipe.dylib. This lib, like all other URE libs is only available as
32 bit binary. Therefore, JRE is unable to load the lib and the pipe connection
to the office cannot be established. 

============================================
[macbookpro-kso:examples/java/DocumentHandling] ks93798% make DocumentConverter.run
mkdir -p
/Users/ks93798/OpenOffice.org3.2_SDK/MACOSXexample.out/misc/JavaDocumentHandlingExamples/converted_files
"/System/Library/Frameworks/JavaVM.Framework/Versions/1.6.0/Commands/java"
-Dcom.sun.star.lib.loader.unopath="/Applications/Oracle Open
Office.app/Contents/MacOS" -jar
/Users/ks93798/OpenOffice.org3.2_SDK/MACOSXexample.out/class/JavaDocumentHandlingExamples/DocumentConverter.jar
"./test" "MS Word 97" "doc"
"/Users/ks93798/OpenOffice.org3.2_SDK/MACOSXexample.out/misc/JavaDocumentHandlingExamples/converted_files"
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.sun.star.lib.loader.Loader.main(Loader.java:138)
Caused by: java.lang.UnsatisfiedLinkError:
com.sun.star.lib.connections.pipe.PipeConnection.createJNI(Ljava/lang/String;)I
	at com.sun.star.lib.connections.pipe.PipeConnection.createJNI(Native Method)
	at com.sun.star.lib.connections.pipe.PipeConnection.<init>(PipeConnection.java:125)
	at com.sun.star.lib.connections.pipe.pipeConnector.connect(pipeConnector.java:134)
	at com.sun.star.comp.connections.Connector.connect(Connector.java:138)
	at
com.sun.star.comp.urlresolver.UrlResolver$_UrlResolver.resolve(UrlResolver.java:120)
	at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:282)
	at DocumentConverter.main(DocumentConverter.java:188)
	... 5 more
============================================

Solution is to enforce 32 bit JRE, for instance by using the "-d32" switch when
invoking java. This holds true not just for Mac OS 10.6. This switch is
available on Mac, Linux and Solaris, but not on Windows!  Refer to
http://java.sun.com/javase/6/docs/technotes/guides/vm/index.html for details for
Standard HotSpot VM Options.
Comment 1 jsc 2010-05-18 09:38:02 UTC
jsc: it's a known problem and not only on Mac OS.  I thought it had been
documented already but it's not. Solution is to document it and find a way to
detect if 32 or 64 bit Java is used. The necessary java option should be
configured then automatically.
Comment 2 kai.sommerfeld 2010-05-18 09:55:13 UTC
>it's a known problem and not only on Mac OS.  I thought it had been
>documented already but it's not. Solution is to document it

 Now it is documented - by this issue. ;-)

> and find a way to detect if 32 or 64 bit Java is used.

 IMO, SDK setup should detect whether 32 or 64 bit Office is to be used with the
SDK and the JRE should be selected/started accordingly.

> The necessary java option should be configured then automatically.

 Agreed.
Comment 3 jsc 2010-06-04 13:06:54 UTC
fixed on cws gridcontrol04

if 64 bit Java is detected, the option -d32 is used to ensure a 32 bit runtime
environment. Used when running Java examples.
Comment 4 jsc 2010-06-10 12:24:14 UTC
jsc -> misheto: please verify
Comment 5 misheto 2010-06-15 10:04:46 UTC
Verified.
Comment 6 misheto 2010-10-13 10:39:26 UTC
.
Comment 7 Ariel Constenla-Haile 2012-10-15 16:32:21 UTC
(In reply to comment #3)
> fixed on cws gridcontrol04
> 
> if 64 bit Java is detected, the option -d32 is used to ensure a 32 bit
> runtime environment

that breaks on Linux 64 bits:

[ariel@localhost OfficeBean]$ make OOoBeanViewer.run
"/opt/jdk1.6/bin/java" -d32 -classpath "/opt/openoffice.org/ure/share/java/jurt.jar:/opt/openoffice.org/ure/share/java/ridl.jar:/opt/openoffice.org/ure/share/java/juh.jar:/opt/openoffice.org/basis3.4/program/classes/unoil.jar:/opt/openoffice.org/basis3.4/program/classes/officebean.jar:/home/ariel/openoffice.org3.4_sdk_x86-64/LINUXexample.out/class/OOoBeanViewer" com.sun.star.comp.beans.OOoBeanViewer

Running a 32-bit JVM is not supported on this platform.
make: *** [OOoBeanViewer.run] Error 1
Comment 8 SVN Robot 2012-10-15 16:35:37 UTC
"arielch" committed SVN revision 1398378 into trunk:
#i111555# - Don't force 32 bits JVM on Linux
Comment 9 Ariel Constenla-Haile 2012-10-15 16:37:57 UTC
(In reply to comment #8)
> "arielch" committed SVN revision 1398378 into trunk:
> #i111555# - Don't force 32 bits JVM on Linux

Please verify I didn't break Mac OS.
Comment 10 Ariel Constenla-Haile 2013-07-21 10:08:14 UTC
Fixed