This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

edparrish presents ...



The scenario shows how to use file I/O (Input/Output) in Greenfoot.

Most file I/O is prevented by the Security Manager when running as an applet. All the scenarios in the Greenfoot Gallery run as applets.

We can do file I/O in the Greenfoot editor or when running as an application. Also, we can read text files that were included in the JAR file for the scenario. Reading from a JAR file is useful, for example, when changing levels or worlds.

To include text files in the JAR file, just add the files to the scenario folder.

Thanks to davmac for his suggestion on how to detect if the scenario is running as an application or as an applet.

The GUI components are part of GUI World at

4179 views / 9 in the last 7 days

1 vote | 0 in the last 7 days

Tags: demo with-source gui file cabrillo i/o

open in greenfoot

There is no HTML 5 translation of this scenario available.
View legacy version (requires Java plugin)

This scenarios uses Java features that are not available for use after conversion to HTML 5. Please try the legacy version, which requires the Java plugin to be installed.

A new version of this scenario was uploaded on Wed Aug 17 22:14:18 UTC 2011 Updated screenshot.

Want to leave a comment? You must first log in.

Who likes this?