Compile a .pde file from within a running sketch

Hey guys! I think it might be possible but I'm not sure... I am making a text editor in processing (don't ask why...) and I want to be able to execute the text from my text editor. This means I have to somehow compile the string (or the file from which the text editor loaded the string) into a temporary file that can be executed, and then use the launch() or exec() function. But I don't know how to easily compile processing code... I know there are many java compilers but they won't work with processing code I think. Help!

Tagged:

Answers

  • Never mind. I found out how to run code from the console within a processing sketch:

    void run() {
      if (files.get(SelectedFile).extension == JAVA) {
        saveText();
        String path = files.get(SelectedFile).file.getPath().replace(files.get(SelectedFile).fileName, "");
        exec("processing-java", "--sketch=" + path, "--run");
      }
    }
    
Sign In or Register to comment.