- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I've got some java classes stored on a directory that a SAS program uses, problem is that I dont know how to add the path to that directory to the Classpath, so the program can run correctly. That's the problem that I'd like to solve.
I've tried adding a set path statement con the sasconfig file and adding the path to the environment variable (I am working on a Windows 7 OS and SAS 9.4/ EG 7.1).
Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried https://support.sas.com/kb/38/518.html?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your response, I got this warning "WARNING: Could not initialize classpath. Classpath variable is not set."
NOTE: Argument not valid for the function SYSGET('CLASSPATH').......
NOTE: Ignore any messages from the next statement(s)
I think it wasn't set correctly then
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Sk4r wrote:
Thank you for your response, I got this warning "WARNING: Could not initialize classpath. Classpath variable is not set."
NOTE: Argument not valid for the function SYSGET('CLASSPATH').......
NOTE: Ignore any messages from the next statement(s)
I think it wasn't set correctly then
This error occurs because the classpath-variable has to exist before it can be modified. So creating it (by setting it to blank) in the server config solved the issue for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@andreas_lds Thank you for your response, could you tell me, please, what steps did follow to set it properly? Just to avoid confusion. Thank you very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Sk4r wrote:
@andreas_lds Thank you for your response, could you tell me, please, what steps did follow to set it properly? Just to avoid confusion. Thank you very much.
Just set an environment-variable on computer on which sas.exe is running. The process depends on the operating system used and is well documented. As value i used a single blank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I am using Windows 7, working on EG 7.1 and local machine, I'm following what this page says Ihttp://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n0swy2q7eouj2fn11g1o...
I tried creating a new environment variable on Windows called CLASSPATH as a blank space and set its value on sas config file writing -SET CLASSPATH "route", but it didn't solve it.
If it wasn't bothersome, could you please tell your sources to do it, or how did you do it specifically, please?
The error became a warning
WARNING: Could not initialize classpath. Classpath variable is not set.
path_separator=;
NOTE: Argumento no válido para la función SYSGET('CLASSPATH') en línea 77 columna 242. <--- This means argument no valid for the function sysget
NOTE: Ignore any messages from the next statement(s)
_ERROR_=1
orig_classpath=
path_separator=; orig_classpath= _ERROR_=1 _N_=1
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply, I appreciate your time, it was holidays.
I created a new environment variable called CLASSPATH set as one blank space.
Then I follow the guide provided on the link to add a new path to the classpath.
After that, I run proc javainfo, but my path is not added to java.class.path, and errors about initializing classpath still occurs.
FS_TEMPLATE = C:\Program Files\SASHome\x86\SASFoundation\9.4\tkjava\sasmisc\qrpfstpt.xml
java.class.path = C:\PROGRA~1\SASHome\SASVER~1\eclipse\plugins\SASLAU~1.JAR
java.class.version = 51.0
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.7.0_76-b13
java.security.auth.login.config = C:\Program
Files\SASHome\x86\SASFoundation\9.4\tkjava\sasmisc\sas.login.config
java.security.policy = C:\Program Files\SASHome\x86\SASFoundation\9.4\tkjava\sasmisc\sas.policy
java.specification.version = 1.7
java.system.class.loader = com.sas.app.AppClassLoader
java.vendor = Oracle Corporation
java.version = 1.7.0_76
java.vm.name = Java HotSpot(TM) Client VM
java.vm.specification.version = 1.7
java.vm.version = 24.76-b04
sas.app.class.path = C:\PROGRA~1\SASHome\SASVER~1\eclipse\plugins\tkjava.jar
sas.ext.config = C:\Program Files\SASHome\x86\SASFoundation\9.4\tkjava\sasmisc\sas.java.ext.config
sas.jre.libjvm = C:\PROGRA~1\SASHome\x86\SASPRI~1\9.4\jre\bin\client\jvm.dll
tkj.app.launch.config = C:\PROGRA~1\SASHome\SASVER~1\picklist
user.country = PE
user.language = es
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please post the code you used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
First, I set environment variable as blank space.
Then, I used the code provided on the link https://support.sas.com/kb/38/518.html
%macro init_classpath_update;
DATA _null_;
LENGTH path_separator $ 2
orig_classpath $ 500;
DECLARE JavaObj f("java.io.File", "");
f.getStaticStringField("pathSeparator", path_separator);
orig_classpath = STRIP(SYSGET("CLASSPATH"));
IF _ERROR_ = 1 OR LENGTH(orig_classpath) = 0 THEN DO;
PUT "NOTE: Ignore any messages from the next statement(s)";
orig_classpath = "";
END;
CALL SYMPUTX('CP_orig_classpath', STRIP(orig_classpath), 'GLOBAL');
CALL SYMPUTX('CP_path_separator', COMPRESS(path_separator), 'GLOBAL');
RUN;
%mend;
%macro add_to_classpath(cp_addition);
DATA _null_;
LENGTH current_classpath $ 500
new_classpath $ 500;
current_classpath = STRIP(SYSGET("CLASSPATH"));
IF _ERROR_ = 1 OR LENGTH(current_classpath) = 0 THEN DO;
PUT "NOTE: Ignore any messages from the nearby statement(s)";
new_classpath = "&cp_addition";
END;
ELSE DO;
new_classpath = COMPRESS(current_classpath) || "&CP_path_separator" || "&cp_addition";
END;
CALL SYMPUTX('CP_new_classpath', STRIP(new_classpath), 'GLOBAL');
RUN;
%PUT NOTE: Setting Java classpath to &CP_new_classpath;
OPTIONS SET=CLASSPATH "&CP_new_classpath";
%mend;
%macro reset_classpath;
%PUT NOTE: Setting Java classpath back to its original state: &CP_orig_classpath;
OPTIONS SET=CLASSPATH "&CP_orig_classpath";
%mend;
/*Set path*/%init_classpath_update;
%add_to_classpath(V:\estadística\fuente\Java\Libreria);
/*Some javaobj code*/
%macro crea_directorio(path);
data crea_directorio;
declare javaobj jd;
jd = _new_ javaobj ('Directorio',&path);
jd.callBooleanMethod ('creaDir', rc);
put 'rc: 1-|El directorio se creo, 0-| El directorio no se creo';
put rc=;
jd.delete();
run;
%mend;
/*Some calls to the macro that uses javaobj*/
%reset_classpath;
is it maybe because the route contains characters that are not ASCII symbols?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
is it maybe because the route contains characters that are not ASCII symbols?
Maybe. But more likely the problem is
%add_to_classpath(V:\estadística\fuente\Java\Libreria);
Are there classes or jars in the folder? If you have jars, you need to add every jar with %add_to_classpath.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your answer, it's a directory with classes, there are no jar files, just like the photo displays below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Well, i don't get it. Extending CLASSPATH the way you did it should make those classes usable in sas. I am sorry, but i don't have any idea how to fix the problem. You should talk to tech support, i am sure they can find a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Well, It's only happening on my computer. I tried the program on another user who uses those java objects, and it runs correctly, while I'm just testing some things that doesn't concern too much on that.
Anyways, thank you for everything.