diff --git a/java/src/processing/mode/java/JavaBuild.java b/java/src/processing/mode/java/JavaBuild.java index 1001ad14b..4091707fc 100644 --- a/java/src/processing/mode/java/JavaBuild.java +++ b/java/src/processing/mode/java/JavaBuild.java @@ -24,8 +24,6 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package processing.mode.java; import java.io.*; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; @@ -249,20 +247,13 @@ public class JavaBuild { File outputFolder = (packageName == null) ? srcFolder : new File(srcFolder, packageName.replace('.', '/')); outputFolder.mkdirs(); -// Base.openFolder(outputFolder); final File java = new File(outputFolder, sketch.getName() + ".java"); - BufferedWriter bw = Files.newBufferedWriter(java.toPath(), StandardCharsets.UTF_8); - final PrintWriter stream = new PrintWriter(bw); + final PrintWriter writer = PApplet.createWriter(java); try { - result = preprocessor.write(stream, bigCode.toString(), codeFolderPackages); + result = preprocessor.write(writer, bigCode.toString(), codeFolderPackages); } finally { - stream.close(); + writer.close(); } - } catch (IOException e) { - e.printStackTrace(); - String msg = "Build folder disappeared or could not be written"; - throw new SketchException(msg); - } catch (antlr.RecognitionException re) { // re also returns a column that we're not bothering with for now // first assume that it's the main file