Hi. I am trying to execute some sample code to connect to SAP. I have encountered a few different errors along the way, and have read the error descriptions in the JCO documentation.
I have placed sapjcorfc.dll in my system32 directory. That solved one problem, but now I am receiving this error:
java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
default_cpc_mode
at com.sap.mw.jco.JCO.<clinit>(Unknown Source)
at jcotest.JcoTest.main(JcoTest.java:44)
Exception in thread "main"
Here is the code:
JCO.Client sapconn = null;
JCO.Repository saprep = null;
JCO.Function func = null;
JCO.Table table = null;
try
{
System.out.println("Creating client...");
// Error on next line:
sapconn = JCO.createClient(client,
user,
pwd,
lang,
sys,
sysno);
System.out.println("Got client. Connecting...");
...
I also replaced librfc32.dll with the new version from the JCO distribution, and I still received the same error.
Thanks in advance for your feedback.
Brendan