Table of Contents
The Java Language Level Facility provides a student-friendly introduction to Java. As of April 2010, there is a single, simplified language level called Functional Java. When used with a complementary curriculum, this language level forms a powerful learning tool.
In the past, there are three levels: Elementary, Intermediate, and Advanced, and each level progressively introduces students to more Java features. Files written using these three language levels can still be compiled, but not be created anymore. The new Functional Java language level can compile files written for the old Elementary and Intermediate language leves; the old Advanced level can be compiled by the regular Java compiler.
The Java Language Level Facility is fully integrated into DrJava. To select the level at which you wish to work, click on the "Language Levels" menu in the menu bar and select a level. If you do not want to use any Language Level, select "Full Java".
Selecting your level affects how new files are saved. Each file's extension specifies its level. Functional Java files are given the .dj extension; Full Java files have the usual .java extension.
In the past, files using the Elementary, Intermediate, and Advanced Levels had the .dj0, .dj1 , and .dj2 extensions, respectively. These files can still be loaded and compiled, but DrJava suggests that you rename .dj0 and .dj1 files to .dj files, and .dj2 files to .java files.
You can reference classes defined at any language level regardless of the level you are currently using, but you cannot reference Full Java files (or old Advanced Level files) unless you have first compiled them seperately.
Because each level is a restricted subset of Full Java,
instructors must be careful when allowing their students to
use library functions. For instance, at the Elementary level,
"null" is not a valid keyword, so functions that may return
null should not be used. Similar caution must be exercised
with arrays. Arrays are not introduced until the Advanced
level, so library functions that rely on arrays should not be
used until then. Also, although we do not allow the mutation
of fields or variables at the Elementary and Intermediate
levels, we do not prohibit the use of library classes with
their own mutation methods such as
java.util.LinkedList
. Because of this,
the students and their teachers must be careful to not use
mutable datatypes.
Internally, the Language Level Facility translates
.dj, .dj0,
.dj1 and .dj2 files
to .java files with the same name. For
example, the file Example.dj
creates the
hidden file named Example.java
. Please
make sure that you do not have both a Java Language Level file
and a .java file with the same name, as
this would overwrite your .java file. We
also advise against opening the generated
.java files. If you do open them, DrJava
will warn you when you compile and ask you to close the
.java files.