Skip to content

Commit

Permalink
Fixed a Windows java compilation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
monadius committed Jan 21, 2021
1 parent 9074fd0 commit 85e563a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,18 @@ any folder on your computer. (Note for macOS users: do not unzip the SPARK distr
folder such as Documents, Downloads, or Desktop.) Double click `SPARK_Manager.jar` in a file manager to run
SPARK. If it does not work then run SPARK from the command line:

macOS/Linux:
```bash
cd 'name of SPARK directory'
bin/spark-manager
```

Windows:
```bash
cd 'name of SPARK directory'
bin\spark-manager
```

## Documentation

Documentation can be found at
Expand Down
19 changes: 7 additions & 12 deletions spark-logo/src/main/java/org/sparklogo/gui/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,7 @@ public void compile(File sparkLibPath) throws Exception {

// Get all java files in the output folder and its sub-folders
ArrayList<File> javaFiles = ProjectFile.findAllFiles(output,
new FilenameFilter() {
public boolean accept(File dir, String fname) {
if (fname.endsWith(".java"))
return true;
else
return false;
}

}, true);
(dir, fname) -> fname.endsWith(".java"), true);

// Create a compiler parameters string
// compilerArgs.add("-verbose");
Expand All @@ -382,21 +374,23 @@ public boolean accept(File dir, String fname) {
final String path = sparkLibPath.getPath();
String jars = Arrays.stream(LIBS)
.map(lib -> Paths.get(path, lib).toAbsolutePath().toString())
.collect(Collectors.joining(":"));
.collect(Collectors.joining(File.pathSeparator));
// System.out.println("jars = " + jars);

//compilerArgs.add(sparkCorePath.getParent());
compilerArgs.add(jars);

for (int i = 0; i < javaFiles.size(); i++) {
compilerArgs.add(javaFiles.get(i).getPath());
for (File javaFile : javaFiles) {
compilerArgs.add(javaFile.getPath());
}

// Get the javac compiler
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
if (compiler == null) {
// Try to use the compiler as an external process
compilerArgs.add(0, "javac");
System.out.println("Compiling java files...");
System.out.println(String.join(" ", compilerArgs));

try {
Process proc = Runtime.getRuntime().exec(
Expand Down Expand Up @@ -430,6 +424,7 @@ public boolean accept(File dir, String fname) {
args = compilerArgs.toArray(args);

System.out.println("Compiling java files...");
System.out.println(String.join(" ", args));
int result = compiler.run(null, null, null, args);


Expand Down

0 comments on commit 85e563a

Please sign in to comment.