File tree Expand file tree Collapse file tree
file-compiler/src/com/sandwich/util/io
koans-lib/src/com/sandwich Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44* /bin /*
55koans /data
66koans /data *
7+ .classpath
8+ .project
Original file line number Diff line number Diff line change 11DIR=" $( cd -P " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
2- mkdir " $DIR " /app
3- mkdir " $DIR " /app/bin
2+ mkdir -p " $DIR " /app
3+ mkdir -p " $DIR " /app/bin
44function exitOnError()
55{
66 rc=$?
77 if [[ $rc != 0 ]] ; then
88 exit $rc
99 fi
1010}
11- javac -help
11+
12+ function buildClasspath()
13+ {
14+ appDir=$1
15+ classpath=$appDir /bin
16+
17+ for jar in $appDir /lib/* ; do
18+ classpath=$classpath :$jar
19+ done
20+ }
21+ javac -help > /dev/null 2>&1
1222exitOnError
13- java -version
23+ java -version > /dev/null 2>&1
1424exitOnError
15- clear
16- java -classpath " $DIR " /app/bin: " $DIR " /app/lib/koans.jar com.sandwich.koan.runner.AppLauncher " $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 " " $9 "
25+ buildClasspath " $DIR " /app
26+ java -classpath $classpath com.sandwich.koan.runner.AppLauncher " $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 " " $9 "
Original file line number Diff line number Diff line change @@ -112,10 +112,12 @@ private String[] getClasspath() {
112112 }else {
113113 return new String []{};
114114 }
115- for (int i = 1 ; i <= classPaths .length ; i ++){
116- classpaths [i ] = classPaths [i - 1 ];
115+
116+ String classpath = "" ;
117+ for (String jar : classPaths ) {
118+ classpath += jar + java .io .File .pathSeparatorChar ;
117119 }
118- return classpaths ;
120+ return new String [] { "-classpath" , classpath } ;
119121 }
120122
121123 public File makeDestination (File dest , String fileInDirectory ) {
Original file line number Diff line number Diff line change @@ -14,8 +14,11 @@ public class KoanClassLoader extends ClassLoader {
1414 public static DynamicClassLoader createInstance () {
1515 String binDir = DirectoryManager .getBinDir ();
1616 String sourceDir = DirectoryManager .getSourceDir ();
17- String [] classPath = new String []{DirectoryManager .getProjectLibraryDir () +
18- DirectoryManager .FILESYSTEM_SEPARATOR + "koans.jar" };
17+ File [] jars = new File (DirectoryManager .getProjectLibraryDir ()).listFiles ();
18+ String [] classPath = new String [jars .length ];
19+ for (int i = 0 ; i < jars .length ; i ++) {
20+ classPath [i ] = jars [i ].getAbsolutePath ();
21+ }
1922 FileMonitor fileMonitor = FileMonitorFactory .getInstance (
2023 new File (DirectoryManager .getProdMainDir ()), new File (DirectoryManager .getDataFile ()));
2124 ClassLoader classLoader = DynamicClassLoader .class .getClassLoader ();
Original file line number Diff line number Diff line change @@ -26,13 +26,17 @@ public void fileSaved(File file) {
2626 String absolutePath = file .getAbsolutePath ();
2727 if (absolutePath .toLowerCase ().endsWith (FileCompiler .JAVA_SUFFIX )){
2828 ApplicationUtils .getPresenter ().displayMessage (KoanConstants .EOL +"loading: " +absolutePath );
29+ File [] jars = new File (DirectoryManager .getProjectLibraryDir ()).listFiles ();
30+ String [] classPath = new String [jars .length ];
31+ for (int i = 0 ; i < jars .length ; i ++) {
32+ classPath [i ] = jars [i ].getAbsolutePath ();
33+ }
2934 try {
3035 FileCompiler .compile (file ,
3136 new File (DirectoryManager .getBinDir ()),
3237 listener ,
3338 ApplicationSettings .getFileCompilationTimeoutInMs (),
34- new String []{DirectoryManager .injectFileSystemSeparators (
35- DirectoryManager .getProjectLibraryDir (), "koans.jar" )});
39+ classPath );
3640 DynamicClassLoader .remove (FileCompiler .sourceToClass (
3741 DirectoryManager .getSourceDir (), DirectoryManager .getBinDir (), file ).toURI ().toURL ());
3842 if (!listener .isLastCompilationAttemptFailure ()){
You can’t perform that action at this time.
0 commit comments