However, Greenfoot takes care of this problem by providing a developing platform, meant for educational purposes, where users can quickly get started and get visual results back in the form of graphics.
Greenfoot runs and uses Java for its programming language, which runs on virtually every operating system without having to re-compile for each operating system.
As I said, Greenfoot is meant to be used in educational environments, though anyone can use it to learn about the language at their own pace. I myself got introduced to the program in my Computer Science course, and so far I’ve learned a lot by using Greenfoot. Note that this program does not actually teach you Java, but instead allows you to easily change the code yourself and see what happens when you do so. Documentation is, of course, provided.
Download and Install
To get started, head to their website and download a copy for your operating system. For the first three options, you should be able to install it as you would install any other program. If you had to choose the “other systems” option, you’ll have to install it by launching the .jar file as an executable. If you run Linux, make sure it has executable rights, then put
java -jar /path/to/file
into your terminal and hit enter. If you use a form of BSD-UNIX, such as FreeBSD, the previous command may not work, so please check what command works for you. Once the installer launches, install to wherever you like, and then launch the executable file in the new folder to run Greenfoot.
When you start Greenfoot, you’ll be greeted by a welcome dialog. If you’ve never used Greenfoot before, I suggest you choose the tutorial scenario. Your browser will then open the tutorial and Greenfoot will launch the tutorial scenario, named “Wombats”.
From there, you can left click on the classes in the right pane and choose whether to add them to the world (by selecting the option and then selecting the cell to put the object into), or whether to open and edit the source code. The code editor carries a couple nice features, including “go to line number”, a location finder on the right side, and background colors to determine which chunks of code go together.
When you feel ready to try it out, add some objects to the world and hit “Run”. You’ll see how your objects behave and learn from the code that makes those objects behave in that way. Note that the tutorial scenario will work out-of-the-box, and adjustments to the provided code are not necessary to get it working.
You can also get help from the community or look at other scenarios at the Greenfoot Gallery. If you try out Greenfoot, I highly advise that you visit the website as well to get a better understanding of what Greenfoot is capable of.
That’s all there is! The rest is up to your imagination, and what you wish to do with it. Remember that you can get help at the Greenfoot Gallery, and definitely check out the documentation for what methods (a series of commands in code that can be called with a simple statement) in the tutorial scenario do and what the provided Greenfoot methods can add. If you need inspiration, check out the Gallery. Some of the projects on there have the source code ready for you to download and study, which is another great technique for learning Java.
How interested are you in learning to write programs? Do you think Greenfoot is a great way to get started? Will you use it to get introduced to Java? Let us know in the comments!