This site requires JavaScript, please enable it in your browser!
Greenfoot back
vtn2@calvin.edu
vtn2@calvin.edu wrote ...

2014/6/2

Are there directions for building greenfoot from source?

vtn2@calvin.edu vtn2@calvin.edu

2014/6/2

#
I'm investigating making some changes to the greenfoot source. Is there documentation on how to build greenfoot? (I have downloaded the source already.) thanks. Vic
davmac davmac

2014/6/2

#
Greenfoot is built on BlueJ (the source bundle comes with BlueJ source and Greenfoot source). Check greenfoot/doc/HOWTO.release / HOWTO.build-in-eclipse, and bluej/doc/HOWTO.make-release. You need the "ant" build tool (or use Eclipse).
vtn2@calvin.edu vtn2@calvin.edu

2014/6/18

#
DavMac, Thanks for the info. We have tried building BlueJ now about 3 or 4 different ways and always run into problems. We are doing this on a Mac Book Pro, with Eclipse. The first questions are: 1. Do we need to set a workspace before we do all this? 2. Do we unzip the source before making the project? 3. Where should the project "home" be? At the Greenfoot-source-2.3.0/ directory or at Greenfoot-source-2.3.0/bluej directory? 4. Is it correct that when configuring the Java Build Path -> Sources, that we will have to create the various classes folders? (In one case we tried creating them from outside of Eclipse before setting them as output folders and that seemed to help, but we still ran into troubles.) 5. Your instructions don't say how to set up the Ant Builder. We guessed at some stuff... 6. We chose to point the Ant Builder at the bluej/build.xml folder -- is that correct? But, there is this line in build.properties: build.properties:bluej_home=/home/davmac/workspace/greenfoot Do we change that to the folder above the bluej folder -- i.e., the Greenfoot-source-2.3.0 folder? (I wonder if this discussion isn't better done outside of this forum. If so, contact me directly, please.) Vic Norman
nccb nccb

2014/6/19

#
1. Yes -- I don't think you can operate Eclipse without a workspace 2. You'll need to unzip it at some stage! Easiest to unzip it first then build a project around that. 3. You'll need two projects: one for bluej (pointing at the .../bluej directory) and one for greenfoot (pointing at the .../greenfoot directory). Set BlueJ up first and make sure it builds and runs before attempting Greenfoot. 4. I think Eclipse creates the output folders for you. 5. I don't think there's anything to set up -- in Eclipse you can always right-click on a build.xml file and say "Run As... Ant Task". That's how I run it, at least. 6. That is the right build.xml file. You will need to alter build.properties in BlueJ and Greenfoot to have the right directories, which are the project directories for Eclipse. That would the .../Greenfoot-source-2.3.0/bluej folder for you (pro tip: use forward slashes always in these files, backslashes are bad news).
Upupzealot Upupzealot

2014/6/19

#
Question: How can I view those "HOWTO" files. What I have done is to rename them to .txt, and then lose the right fomat.
nccb nccb

2014/6/19

#
They are text files. Double-clicking in Eclipse opens them, or use any text editor.
vtn2@calvin.edu vtn2@calvin.edu

2014/6/20

#
Thanks for the info. I am getting a lot closer to success here. I'll post a much more detailed description of the steps I used to compile greenfoot as soon as I succeed. Meanwhile, I have a problem building greenfoot (I've successfully built bluej). I'm in these steps from the Greenfoot build instructions: Run the "ready-to-run" target in the BlueJ project. Run the "ready-to-run" target in the Greenfoot project. For the second line, when I build, I get this error: Buildfile: /Users/vtn2/build_gf/greenfoot/build.xml update-images: init: compile: executable is ${build_java_home}/${java_command_dir_name}/javac /Users/vtn2/build_gf/greenfoot/build.xml:198: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds Compiling 317 source files to /Users/vtn2/build_gf/greenfoot/classes BUILD FAILED /Users/vtn2/build_gf/greenfoot/build.xml:198: Error running ${build_java_home}/${java_command_dir_name}/javac compiler Total time: 1 second As far as I can tell, my build_java_home/java_command_dir_name/javac should be correct. I'm building on Mac and I've set the java_command_dir_name to Commands, so that should be good. But obviously something is wrong. How do I debug this problem? I added the echo message above the compile instruction in the build.xml file, but the ${build_java_home}, etc. are not getting expanded to their actual values. How do you debug Ant? Thanks. Vic
vtn2@calvin.edu vtn2@calvin.edu

2014/6/20

#
I've figured out more info. I found you can set the ant build command-line arguments, so I've added -d to that, to turn on debugging. Now, I see this in the output: Property "build_java_home" has not been set Property "java_command_dir_name" has not been set These values are set in the bluej/build.properties file. Do they need to be copied into the greenfoot/build.properties file as well?
vtn2@calvin.edu vtn2@calvin.edu

2014/6/20

#
I think I figured out the problem. In the greenfoot/build.properties file, change this line bluej.projectdir=/home/davmac/workspace/greenfoot to this value: bluej.projectdir=/Users/vtn2/build_gf/bluej I had the /Users/vtn2/build_gf part correct, but the existing line suggests it should point at greenfoot. When you change to point to bluej the build_java_home property, etc., get used in the build.
nccb nccb

2014/6/21

#
So is it now working for you? You're right that pointing Greenfoot's build.properties file to BlueJ's build.properties picks up the location of Java. Also: you only need to change java_command_dir_name to Commands on Apple's JDK 6; if you are using Oracle's JDK 7 or 8 on Mac (definitely advised), it uses "bin" as the java_command_dir_name.
vtn2@calvin.edu vtn2@calvin.edu

2014/6/25

#
I have successfully built BlueJ and Greenfoot now. Here is a much more detailed "log" of how I built it, which may be useful to others in the future. This way built on Mac OS. 1. mkdir ~/build_gf 2. cd ~/build_gf 3. unzip ../Greenfoot-source-2.3.0 4. Mac21495:build_gf vtn2$ ll total 0 drwxr-xr-x 4 vtn2 staff 136 Jun 19 20:47 ./ drwx--x--x 92 vtn2 staff 3128 Jun 19 20:46 ../ drwxr-xr-x 13 vtn2 staff 442 Apr 25 2013 bluej/ drwxr-xr-x 14 vtn2 staff 476 Apr 25 2013 greenfoot/ 5. Start up Eclipse Classic 4.2.2.app 6. Switched workspace to /Users/vtn2/build_gf. Eclipse restarts. 7. New --> Java Project o called the project "bluej" 8. Clicked Finish. 9. Selected project bluej and clicked Project --> Properties. o Select Java Build Path o Clicked "Allow output folders for source folders." 10. Under bluej/src, selected "Output folder: (default output folder)" o Clicked Edit o Selected "Specific output folder (path relative to "bluej"), then Browse. o Open bluej/src, then click Create New Folder... and create classes o Click OK. 11. Click Add Folder... o Select bluej/boot/src. o Select Output Folder: ... and click Edit. o Select bluej/boot/, create New folder "classes". Select it. 12. Click Add Folder... do the same for test/src --> test/classes. 13. Switch to Resources item and set Text file encoding to Other: UTF-8 14. Back to Java Build Path --> Libraries tab. o Clicked Add JARs... 15. Clicked Add External Jars... o Found tools.jar in /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/lib/tools.jar 16. Go to Run Configurations... o Added new Java Application item, called it bluej o Project is bluej o Set Main class to bluej.Boot. o Set the arguments to -useclassesdir=true -bluej.debug=true 17. In Classpath tab: o bootstrap entry is only the JRE o Selected User Entries. Clicked Advanced... o Selected Add Folders... Added bluej/boot/classes. o Could not figure out how to delete other stuff... 18. Close the Run Configuration dialog. 19. From package explorer, double click on build.properties. o clicked on build.properties tab. o uncommented build_java_home line for MAC and commented out the others. o now set to build_java_home=/System/Library/Frameworks/JavaVM.framework/Versions/1.6 o set mac_bundled_jdk_path=/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk o set bluej_home=/Users/vtn2/build_gf/bluej o set java_command_dir_name=Commands (for Mac) o saved changes 20. From package explorer, selected build.xml. o right-click and choose Run As Ant Build... 21. Build successful! Buildfile: /Users/vtn2/build_gf/bluej/build.xml compile-boot: jar-boot: Building jar: /Users/vtn2/build_gf/bluej/lib/bluej.jar compile-core: jar-core: Building jar: /Users/vtn2/build_gf/bluej/lib/bluejcore.jar jar-editor: Building jar: /Users/vtn2/build_gf/bluej/lib/bluejeditor.jar jar-extension: Building jar: /Users/vtn2/build_gf/bluej/lib/bluejext.jar ready-to-run: BUILD SUCCESSFUL Total time: 3 seconds --------------------------------------------------------------------------- Now, to build Greenfoo: 1. Created new Java project: greenfoot, with root at the build_gf/greenfoot folder. 2. Open Project -> Properties. o Under Java Build Path --> Source tab, o selected "Allow output folders for source folders" o under greenfoot/src, selected "Output folder: ...", click Edit. o select "Specific output folder", then "Browse", then "greenfoot", then "Create New Folder...", then type in "classes". Click OK. o under greenfoot/test/src, selected "Output folder: ...", click Edit. o select "Specific output folder", then "Browse", then "greenfoot", then "test", then "Create New Folder...", then type in "classes". Click OK. 3. Instructions say to Go to Libraries tab, then add all the JARS in the lib folder. o The lib folder does not exist and those jars are already listed there. So, I assume I don't have to do anything there. 4. Go to Projects tab and select bluej project. Click OK. 5. In Project Explorer: select build.properties, right click and choose Open with... Properties file editor. o Edited file to look like this: # Location of the BlueJ project # bluej.projectdir=/Users/vtn2/build_gf/greenfoot bluej.projectdir=/Users/vtn2/build_gf/bluej # Location of the Greenfoot project greenfoot.projectdir=/Users/vtn2/build_gf/greenfoot 6. Opened ant view: Window - Show view - Ant. o Dragged root-level build.xml files from bluej project and greenfoot project into the view. o Under bluej, selected "ready-to-run ". Clicked the green "Run" button at the top. Results: Buildfile: /Users/vtn2/build_gf/bluej/build.xml compile-boot: jar-boot: Deleting: /Users/vtn2/build_gf/bluej/lib/bluej.jar Building jar: /Users/vtn2/build_gf/bluej/lib/bluej.jar compile-core: jar-core: Deleting: /Users/vtn2/build_gf/bluej/lib/bluejcore.jar Building jar: /Users/vtn2/build_gf/bluej/lib/bluejcore.jar jar-editor: Deleting: /Users/vtn2/build_gf/bluej/lib/bluejeditor.jar Building jar: /Users/vtn2/build_gf/bluej/lib/bluejeditor.jar jar-extension: Deleting: /Users/vtn2/build_gf/bluej/lib/bluejext.jar Building jar: /Users/vtn2/build_gf/bluej/lib/bluejext.jar ready-to-run: BUILD SUCCESSFUL Total time: 3 seconds o Under greenfoot, selected "ready-to-run". Clicked the green "Run" button at the top. Results: <lots of lines omitted here> Building tree for all the packages and classes... /Users/vtn2/build_gf/greenfoot/src/greenfoot/Actor.java:586: warning - @return tag has no arguments. Building index for all the packages and classes... Building index for all classes... Generating /Users/vtn2/build_gf/greenfoot/doc/API/help-doc.html... 1 warning copy-apidocs: Copying 19 files to /Users/vtn2/build_gf/bluej/doc copy-labels: ready-to-run: BUILD SUCCESSFUL Total time: 13 seconds
You need to login to post a reply.