本文以SAP JCo_3.04为例,阐述如何安装SAP JCO。
JCo有32位和64为之分,那么我们将如何选择JCo的位数呢?很简单,32位的JVM选择32位的JCO,
64位的JVM选择64位的JCO, 在windows环境,选择相应的sapjco3.dll, Unix和Linux环境选择合适
的sapjco3.so 。
[b]下边是关于如何选择JCO的简介:[/b]
Windows XP, Windows Vista, Windows 2003 and Windows 2008
•sapjco3-ntintel-3.0.3.zip for a 32-bit JRE running on a 32-bit AMD or INTEL x86 or a 64-bit INTEL Itanium processor
•sapjco3-ntia64-3.0.3.zip for a 64-bit JRE running on a 64-bit INTEL Itanium processor
•sapjco3-ntamd64-3.0.3.zip for a 64-bit JRE running on a 64-bit AMD or INTEL x86 proces
Linux
•sapjco3-linuxintel-3.0.3.tgz for a 32-bit JRE running on a 32-bit AMD or INTEL x86 processor
•sapjco3-linuxia64-3.0.3.tgz for a 64-bit JRE running on a 64-bit INTEL Itanium processor
•sapjco3-linuxx86_64-3.0.3.tgz for a 64-bit JRE running on a 64-bit AMD or INTEL x86 processor
•sapjco3-linuxppc64-3.0.3.tgz for a 64-bit JRE running on a 64-bit PowerPC processor
•sapjco3-linuxs390x-3.0.3.tgz for a 64-bit JRE running on a 64-bit IBM eServer zSeries processor
SUN
•sapjco3-sun_64-3.0.3.tgz for a 64-bit JRE running on a 64-bit SUN SPARC processor
•sapjco3-sunx86_64-3.0.3.tgz for a 64-bit JRE running on a 64-bit AMD or INTEL x86 processor
IBM AIX
sapjco3-rs6000_64-3.0.3.tgz for a 64-bit JRE running on a 64-bit IBM RS/6000 processor
IBM i
sapjco3-as400_pase_64-3.0.3.tar for a 64-bit JRE running on a 64-bit IBM i system
HP
•sapjco3-hp_64-3.0.3.tgz for a 64-bit JRE running on a 64-bit PA-RISC processor
•sapjco3-hpia64-3.0.3.tgz for a 64-bit JRE running on 64-bit INTEL Itanium processor
Apple Mac OS X
•sapjco3-darwinintel-3.0.3.zip for a 32-bit JRE on a 32-bit INTEL x86 processor
•sapjco3-darwinintel64-3.0.3.zip for a 64-bit JRE running on a 64-bit INTEL x86 processor
[b]下面介绍如何安装JCO[/b]
知道如何选择JCO之后, 安装的过程并不难,只要设好相应的环境变量就好了。下面以Windows 32bit环境为例,同时也会穿插一些Linux的内容。
1. 复制sapjco3.dll到c:/windows/system32/目录,或者, 复制sapjco3.dll到目录D:/Resources/Libraries/SAPJCo/JCO_304,
然后加入目录D:/Resources/Libraries/SAPJCo/JCO_304到环境变另PATH中(至于如何修改环境变量PATH,这里不再叙述)。
注:
在Linux和Solaris环境下,复制sapjco3.so到任何一个目录中去,例如:/usr/local/jco3, 然后修改/etc/profile文件,把目录/usr/local/jco3加入到环境变量LD_LIBRARY_PATH中。
2. 加入windows需要的DLL, 复制 msvcr80.dll 和 msvcp80.dll 文件到目录 C:/windows/system32/
3. 恭喜你,你已经安装好了JCO, 就这么简单, 我们现在要做的就是测试安装成功与否,很简单,打开一个命令行,使用下列命令:
java -jar JCO_DIRECTORY/sapjco3.jar
或者
java -cp JCO_DIRECTORY/sapjco3.jar com.sap.conn.jco.rt.About
如果命令执行无误, 你将会看到一个对话框,如下图所示:
[img]http://hi.csdn.net/attachment/201007/4/0_1278248605Mr3M.gif[/img]
注意变量Paths, JCo Classes 和 JCo library 都被正确的载入了,说明你的安装时正确的。
如果你发现有下面的错误出现,请参考第一部分-如何选择JCO,很有可能你的JVM是32位的,而你选择了64位的JCO,反之亦然。
ava.lang.UnsatisfiedLinkError: /opt/xynapse/idpf/config/libsapjco3.so: /opt/xynapse/idpf/config/libsapjco3.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at com.sap.conn.jco.rt.DefaultJCoRuntime.loadLibrary(DefaultJCoRuntime.java:441)
at com.sap.conn.jco.rt.DefaultJCoRuntime.registerNativeMethods(DefaultJCoRuntime.java:307)
at com.sap.conn.jco.rt.JCoRuntime.registerNatives(JCoRuntime.java:987)
at com.sap.conn.rfc.driver.CpicDriver.<clinit>(CpicDriver.java:948)
at com.sap.conn.rfc.engine.DefaultRfcRuntime.getVersion(DefaultRfcRuntime.java:43)
at com.sap.conn.rfc.api.RfcApi.RfcGetVersion(RfcApi.java:259)
at com.sap.conn.jco.rt.MiddlewareJavaRfc.<clinit>(MiddlewareJavaRfc.java:200)
at com.sap.conn.jco.rt.DefaultJCoRuntime.initialize(DefaultJCoRuntime.java:73)
at com.sap.conn.jco.rt.JCoRuntimeFactory.<clinit>(JCoRuntimeFactory.java:23)
at com.sap.conn.jco.rt.About.<init>(About.java:40)
at com.sap.conn.jco.rt.About.main(About.java:74)
java.lang.ExceptionInInitializerError: Error getting the version of the native layer: java.lang.UnsatisfiedLinkErro r: /opt/xynapse/idpf/config/libsapjco3.so: /opt/xynapse/idpf/config/libsapjco3.so: wrong ELF class: ELFCLASS64 (Pos sible cause: architecture word width mismatch)
JCo有32位和64为之分,那么我们将如何选择JCo的位数呢?很简单,32位的JVM选择32位的JCO,
64位的JVM选择64位的JCO, 在windows环境,选择相应的sapjco3.dll, Unix和Linux环境选择合适
的sapjco3.so 。
[b]下边是关于如何选择JCO的简介:[/b]
Windows XP, Windows Vista, Windows 2003 and Windows 2008
•sapjco3-ntintel-3.0.3.zip for a 32-bit JRE running on a 32-bit AMD or INTEL x86 or a 64-bit INTEL Itanium processor
•sapjco3-ntia64-3.0.3.zip for a 64-bit JRE running on a 64-bit INTEL Itanium processor
•sapjco3-ntamd64-3.0.3.zip for a 64-bit JRE running on a 64-bit AMD or INTEL x86 proces
Linux
•sapjco3-linuxintel-3.0.3.tgz for a 32-bit JRE running on a 32-bit AMD or INTEL x86 processor
•sapjco3-linuxia64-3.0.3.tgz for a 64-bit JRE running on a 64-bit INTEL Itanium processor
•sapjco3-linuxx86_64-3.0.3.tgz for a 64-bit JRE running on a 64-bit AMD or INTEL x86 processor
•sapjco3-linuxppc64-3.0.3.tgz for a 64-bit JRE running on a 64-bit PowerPC processor
•sapjco3-linuxs390x-3.0.3.tgz for a 64-bit JRE running on a 64-bit IBM eServer zSeries processor
SUN
•sapjco3-sun_64-3.0.3.tgz for a 64-bit JRE running on a 64-bit SUN SPARC processor
•sapjco3-sunx86_64-3.0.3.tgz for a 64-bit JRE running on a 64-bit AMD or INTEL x86 processor
IBM AIX
sapjco3-rs6000_64-3.0.3.tgz for a 64-bit JRE running on a 64-bit IBM RS/6000 processor
IBM i
sapjco3-as400_pase_64-3.0.3.tar for a 64-bit JRE running on a 64-bit IBM i system
HP
•sapjco3-hp_64-3.0.3.tgz for a 64-bit JRE running on a 64-bit PA-RISC processor
•sapjco3-hpia64-3.0.3.tgz for a 64-bit JRE running on 64-bit INTEL Itanium processor
Apple Mac OS X
•sapjco3-darwinintel-3.0.3.zip for a 32-bit JRE on a 32-bit INTEL x86 processor
•sapjco3-darwinintel64-3.0.3.zip for a 64-bit JRE running on a 64-bit INTEL x86 processor
[b]下面介绍如何安装JCO[/b]
知道如何选择JCO之后, 安装的过程并不难,只要设好相应的环境变量就好了。下面以Windows 32bit环境为例,同时也会穿插一些Linux的内容。
1. 复制sapjco3.dll到c:/windows/system32/目录,或者, 复制sapjco3.dll到目录D:/Resources/Libraries/SAPJCo/JCO_304,
然后加入目录D:/Resources/Libraries/SAPJCo/JCO_304到环境变另PATH中(至于如何修改环境变量PATH,这里不再叙述)。
注:
在Linux和Solaris环境下,复制sapjco3.so到任何一个目录中去,例如:/usr/local/jco3, 然后修改/etc/profile文件,把目录/usr/local/jco3加入到环境变量LD_LIBRARY_PATH中。
2. 加入windows需要的DLL, 复制 msvcr80.dll 和 msvcp80.dll 文件到目录 C:/windows/system32/
3. 恭喜你,你已经安装好了JCO, 就这么简单, 我们现在要做的就是测试安装成功与否,很简单,打开一个命令行,使用下列命令:
java -jar JCO_DIRECTORY/sapjco3.jar
或者
java -cp JCO_DIRECTORY/sapjco3.jar com.sap.conn.jco.rt.About
如果命令执行无误, 你将会看到一个对话框,如下图所示:
[img]http://hi.csdn.net/attachment/201007/4/0_1278248605Mr3M.gif[/img]
注意变量Paths, JCo Classes 和 JCo library 都被正确的载入了,说明你的安装时正确的。
如果你发现有下面的错误出现,请参考第一部分-如何选择JCO,很有可能你的JVM是32位的,而你选择了64位的JCO,反之亦然。
ava.lang.UnsatisfiedLinkError: /opt/xynapse/idpf/config/libsapjco3.so: /opt/xynapse/idpf/config/libsapjco3.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at com.sap.conn.jco.rt.DefaultJCoRuntime.loadLibrary(DefaultJCoRuntime.java:441)
at com.sap.conn.jco.rt.DefaultJCoRuntime.registerNativeMethods(DefaultJCoRuntime.java:307)
at com.sap.conn.jco.rt.JCoRuntime.registerNatives(JCoRuntime.java:987)
at com.sap.conn.rfc.driver.CpicDriver.<clinit>(CpicDriver.java:948)
at com.sap.conn.rfc.engine.DefaultRfcRuntime.getVersion(DefaultRfcRuntime.java:43)
at com.sap.conn.rfc.api.RfcApi.RfcGetVersion(RfcApi.java:259)
at com.sap.conn.jco.rt.MiddlewareJavaRfc.<clinit>(MiddlewareJavaRfc.java:200)
at com.sap.conn.jco.rt.DefaultJCoRuntime.initialize(DefaultJCoRuntime.java:73)
at com.sap.conn.jco.rt.JCoRuntimeFactory.<clinit>(JCoRuntimeFactory.java:23)
at com.sap.conn.jco.rt.About.<init>(About.java:40)
at com.sap.conn.jco.rt.About.main(About.java:74)
java.lang.ExceptionInInitializerError: Error getting the version of the native layer: java.lang.UnsatisfiedLinkErro r: /opt/xynapse/idpf/config/libsapjco3.so: /opt/xynapse/idpf/config/libsapjco3.so: wrong ELF class: ELFCLASS64 (Pos sible cause: architecture word width mismatch)