Search code examples
javaintellij-ideagreenfoot

Exporting Java to Greenfoot


Rather than using Greenfoot, I've just imported the Greenfoot library into IntelliJ so I can code there externally. If I wanted to import that Java code from IntelliJ back into Greenfoot to test, it would require the construction of a project.greenfoot file. How are those built by Greenfoot, or how would I put one together myself so that the code would run in Greenfoot?


Solution

  • The world's worst IDE will automatically pick up .java files in the project directory on open. So the easiest way to dump a bunch of Java files into a Greenfoot project is to make a new project, close Greenfoot, delete all the files except project.greenfoot (and the images and sounds directory), copy in your .java files, and re-open Greenfoot.

    Incidentally, you don't have to take your code back into Greenfoot to test it. We have instructions on how to run Greenfoot projects within NetBeans, which I think shouldn't be too hard to translate across to IntelliJ. That would allow you to develop and run Greenfoot projects from IntelliJ without ever opening the Greenfoot IDE.