javajco

Connect SAP System


I am working in a Java EE project that integrates with SAP system, and I am trying to run a simple standalone Java class that calls a RFC. My snippet of code is

JCO.Client mConnection =
    JCO.createClient("dummy", // SAP client
             "dummy", // userid
             "dummy", // password
                 "dummy", // language (null for the default language)
                 "dummy", // application server host name
                 "dummy"); // system number

It throws the following exception

JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'

JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc

The only library that I have in this moment is sapjco.jar, I have seen in some forums that I need this two libraries (librfc32.dll, sapjcorfc.dll) to be able to run this code in an standalone application.

Is that right? Where can I get these two libraries? The last one is to put in the same folder than the sapjco.jar, is that ok too?

If I cannot run this in my local computer I will have to deploy the application every time that I want to test it :(


Solution

  • Depending on which JCo version you use (you didn't state that), you need one or two platform-specific native libraries. They come bundled with the JCo package, along with some installation documentation. If you don't have this, you've got an incomplete and probably illegal package (redistribution is not allowed). Go to http://service.sap.com/connectors and get the valid one.