
%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;

