2
votes

I am trying to call a java class object from a data step in SAS. The Java class file has been placed in the class path./dir/folder_location

The class path variable for SAS has been changed to the folder where the class files are stored. This has been verified from the SAS enterprise Guide where I am printing the class path to the logs

SYSGET("CLASSPATH") returns /dir/folder_location

When I run the following path to declare a java object in the class:

   data _null_;
   declare javaobj j ('Classname');
   run;

This gives me an error that

ERROR: Could not find class 'ClassName' at line x column y. Please ensure that the CLASSPATH is correct. ERROR: DATA STEP Component Object failure. Aborted during the EXECUTION phase.

Als when i get the java info by using the command

PROC javainfo CLASSPATHS;
run;

This returns a different path. Is this different than the above class path?

Does anyone have thoughts on as to why this is happening and what the solution is?

Thanks in advance.

3

3 Answers

2
votes

Is your Java class in a JAR file, by chance? If so, the documentation seems to say the classpath needs to include the .jar file.

In SAS, you must set the CLASSPATH environment variable so that the Java object can find your Java classes. The Java object represents an instance of a Java class that is found in the current Java classpath. Any class that you use must appear in the classpath. If the class is in a .jar file, then the .jar filename must appear in the classpath.

http://support.sas.com/documentation/cdl/en/lrcon/67227/HTML/default/viewer.htm#n0swy2q7eouj2fn11g1o28q57v4u.htm#p1eop5jjb9digin1adfp22tmssl0

1
votes

SAS documentation is as crap as usual in this subject (either). In client/server application the spawner omits the user's enviroment variables on the server. Fortunately I found a very simple solution. Try this: options set=CLASSPATH "your classpaths here";

0
votes

Maybe you can set classpath in simple mode in sasv9 config file.

It is usually on this installation path:

c:\SAS94\x86\SASFoundation\9.4\sasv9.cfg

Or not x86 version on:

c:\SAS94\SASFoundation\9.4\sasv9.cfg

You can register your JAR file in this row end on the config.

Example:

-Dsas.app.class.path=/sas/sas94/SASVersionedJarRepository/eclipse/plugins/tkjava.jar:/yourpath/your.jar

I remember the earlier version are same (9.3,9.2,9.1)