cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the Classpath?

Former Member
0 Kudos

i have some jar files in a folder ,so i want to set their path to Java.class.path, so some deployed Applications can load and call classes packed in them ? where can i config the classpath and how to config them?

thanks very much.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member192029
Active Contributor
0 Kudos

Set JAVA_HOME path and Class path (upto jdk/lib folder) details in environment variable. it should work

former_member184385
Active Participant
0 Kudos

Hi Guoging,

there are at least to ways to make jars available for applications

1) Creating a server lib and letting your apps reference this lib, giving access to all the classes, it contains

2) Packaging the jars with your apps, makeing them kind of private to your apps:

- for web apps, put the jars in the WEB-INF/lib folder

- for j2ee and webdynpro apps, put the jars in the lib folder

Regards

Gregor

Former Member
0 Kudos

at first, thanks for you reply.i know two ways you said ,but those must lay down some jar files into the sap was directory. so through set classpath, i can include any jars wherever they locate.

so can i set classpath enviroment to do it? sap's application classloader can load them or not?

Former Member
0 Kudos

Hi,

All you need to do is to define CLASSPATH environment variable specifing the path to your JARs. It should work on Windows or Unix both.

Regards,

Mike

Former Member
0 Kudos

following your reply, i try it, but it don't work,

i do a test

public class SayHello{

public static String say(){

return "hello,world"

}

i package this class into sayhello.jar and set its path into the classpath.

in a webapplication, in a doGet method of servlet ,i call SayHello.say(),some exceptions be thrown. java.lang.ClassNotFoundError.

how do you do them ? please give me some info in details ,thanks

former_member184385
Active Participant
0 Kudos

Hi Guoging,

do as I advised in the preview post; take either alternative 1 or 2.

The usual classpath env. variable or the classpath parameter of the java executable has no meaning in the NW context! NW classloaders rule in NW world and you have to behave accordingly.

Regards

Gregor