I wrote a script to concatenate a variable called classpath_augment
using python. I was able to successfully concatenate directories and the contained jar files to the classpath_augment
variable, however, I also need to add to the classpath variable those directories that contain .properties
files.
How can I do that?
Below is my code:
#! /usr/bin/env python
import os
import sys
import glob
java_command = "/myappsjava/home/bin/java -classpath "
def run(project_dir, main_class, specific_args):
classpath_augment = ""
for r, d, f in os.walk(project_dir):
for files in f:
if (files.endswith(".jar")):
classpath_augment += os.path.join(r, files)+":"
if (classpath_augment[-1] == ":"):
classpath_augment = classpath_augment[:-1]
args_passed_in = '%s %s %s %s' % (java_command, classpath_augment, main_class, specific_args)
print args_passed_in
#os.system(args_passed_in)