cancel
Showing results for 
Search instead for 
Did you mean: 

Problems in Reflectin JCO Class

Former Member
0 Kudos

Hello.

I am new to Java but very used to ABAP. To start some experiments in Java I want to check, whether JCO Library is available using Reflection-API.

Therefore I wrote the following code:


		Class jcoclass;
		try {
			// try to retrieve descriptor for JCo class
			ClassLoader.getSystemClassLoader().loadClass("com.sap.mw.jco.JCO");
			jcoclass = Class.forName("com.sap.mw.jco.JCO", true, ClassLoader.getSystemClassLoader());
			
			if (jcoclass != null) {
				// successful
				System.out.println("SAP JCo Library available");
			} //if (jcoclass != null)

Unfortunately, this causes a ClassNotFoundException. As soon as I adopt the code to check whether Java ClassLoader is able to load a standard class (here: String), it works:


		Class jcoclass;
		try {
			// try to retrieve descriptor for JCo class
			ClassLoader.getSystemClassLoader().loadClass("java.lang.String");
			jcoclass = Class.forName("java.lang.String", true, ClassLoader.getSystemClassLoader());
			
			if (jcoclass != null) {
				// successful
				System.out.println("SAP JCo Library available");
			} //if (jcoclass != null)

I guess, that my mistake is either the "full qualified name" of the JCo class ("com.sap.mw.jco.JCO"), or a mislocated JCo Library. The JCo Library Files ("librfc32.dll", "sapjco.jar" and "sapjcorfc.dll") are located in the same directory, where the compiled class is located. The dll Files are additionally located in C:\WINDOWS\system32\.

Please help me startung off with Java

Additional information:

- I am using JDK 1.6.0_06 and

- SAP JCo Library 2.1.8 32bit

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Solved the problem on my own:

The CLASSPATH contained the directory containing "sapjco.jar", but not "sapjco.jar" itself.

"sapjco.jar" is located in directory "C:\JCo\". So, my CLASSPATH was confgured to be ".;C:\JCO\". But it should have been configured to ".;C:\JCO\sapjco.jar".