def add_to_classpath(file)
      unless File.exist?(file) then
        logger.warn("File to place on Java classpath does not exist: #{file}")
        return
      end
      if File.extname(file) == '.jar' then
        # require is preferred to classpath append for a jar file.
        require file
      else
        # A directory must end in a slash since JRuby uses an URLClassLoader.
        if File.directory?(file) then
          last = file[-1, 1]
          if last == "\\" then
            file = file[0...-1] + '/'
          elsif last != '/' then
            file = file + '/'
          end
        end
        # Append the file to the classpath.
        $CLASSPATH << file
      end
    end
def add_to_classpath(file)
      unless File.exist?(file) then
        logger.warn("File to place on Java classpath does not exist: #{file}")
        return
      end
      if File.extname(file) == '.jar' then
        # require is preferred to classpath append for a jar file.
        require file
      else
        # A directory must end in a slash since JRuby uses an URLClassLoader.
        if File.directory?(file) then
          last = file[-1, 1]
          if last == "\\" then
            file = file[0...-1] + '/'
          elsif last != '/' then
            file = file + '/'
          end
        end
        # Append the file to the classpath.
        $CLASSPATH << file
      end
    end
Adds the given jar file or directory to the classpath.

 @param [String] file the jar file or directory to add