Why is this Java code not working

Java editor


You need administrative rights for some configurations and the installation of extensions. To get it, right-click the context menu of the Java Editor symbol on your desktop and select “Run as administrator”. If you install an extension under Windows Vista without administrative rights, e.g. B. the Jikes compiler, the installed files are saved in a shadow area.

Open the configuration window with the command configuration from the window menu or simply by clicking the icon on the toolbar and select the desired configuration node from the configuration tree on the left.

With the Check-Switch check whether the configured directories and files exist. If a directory or a file does not exist, the relevant input field is colored red.

The Output-Switch exports the entire configuration to a text file. The first lines show which registry entries or INI files are used. The detailed information can be used to identify configuration problems or to make global specifications in a networked PC room environment.

to save The edited configuration. Almost all changed settings take effect immediately, only a few require a restart of the Java editor.


The configuration settings in the Java are protected. They can only be changed with administrative rights. If you have installed the Java editor with registry usage, the settings of the Java area are saved in the branch HKEY_LOCAL_MACHINE (HKLM), otherwise in the INI file JEMachine.INI of the installation folder, i.e. C: \ Program Files (x86) \ JavaEditor \ JEMachine.INI or C: \ Program Files \ JavaEditor \ JEMachine.INI.

The other configuration settings are saved separately for each user in the branch HKEY_CURRENT_USER (HKCU) or the INI file JEUser.INI, the location of which is specified in the JEMachine.INI file.


The path to the Java Development Kit (JDK) must be set. This is best done using the Select button, because then the other paths will be adjusted accordingly. The dependent subdirectories, programs and documentation are determined on the basis of this path.

The Classpath admin is protected.

over Classpath user you can add jar files or folders to your classpath.

To integrate the “Pens and Mice” package from the North Rhine-Westphalia education server, the Classpath user could be set as follows: E: \ SuM \ SuMKomponenten.jar; E: \ SuM \ SuMEreignis.jar

Under JavaDoc folder you can specify additional folders with JavaDoc compatible documentation. These are then also used for code completion.

If additional packages are to be installed as described in the Java book, they should be stored in a folder E: \ Java \ classes and then extended the classpath admin as follows:.; E: \ j2sdk1.4.2_04 \ jre \ lib \ rt.jar ; E: \ Java \ classes

The Java editor writes a batch file RunJava.bat to start Java programs. The relevant switch opens the last used RunJava.bat file. So you can inspect them and easily change them if unexpected problems arise when starting programs. Change @ECHO OFF to @ECHO ON and add between the lines and at the end BREAK. Then open a DOS window with the window menu and start the batch file in the DOS window by entering RunJava.bat. This is an easy way to diagnose problems when programs won't start.


Here you set the paths and parameters for the Java compiler. The Java compiler javac.exe is part of the Java Development Kit (JDK).

Use that Make modeif you want to automatically compile all open files that are younger than their associated class files.

In the setting Use Java compiler internally the Java compiler is loaded into the Java virtual machine during the first compilation and used from there. The Java compiler does not have to be reloaded for further compiler calls, which makes compiling much faster. However, this option is switched off by default because some users have reported problems with this function.


Here you configure the debugger and the JavaDoc documenter of the JDK.


On this page you configure the handling of applets. The Applet viewer belongs to the JDK. You can use the applet viewer or a browser to run applets. Usually the applet viewer is better suited for program development because it does not use a cache. Use the setting for flexible handling of applets Appletviewer for Java files and browser for HTML files. When starting a Java file with an applet, a suitable HTML file is generated by default and then the applet viewer is called; However, if you start the HTML file of an applet, the applet will be displayed in the browser.

Alternatives are


    The JDK disassembler javap.exe is used by default. A better choice is the JAD disassembler. Choose jad.exe from the disassembler selection. You can then install it automatically, provided you have administrative rights (see configuration).


    On this page you configure the jar tool from the JDK. The two options parameter and manifest are used in all calls to the Jar tool. With the options Produce and pack the following must be observed:

    • The start menu contains the command Create jar file. This command creates a jar file that can be executed directly under Windows (similar to an exe file) with all files from the current folder and the file extensions configured here. By default, only .class files are included in the Jar file. If necessary, the list of file extensions can be supplemented, for example .class .png
    • The start menu also contains the command Pack the jar file. This command creates an archive file (like a ZIP file) with all files that are configured here. Enter the file extensions you want or select:

      The pack operation enables easy exchange of files between students and teachers. A zipped jar file can easily be uploaded to a learning platform or sent to the teacher via email attachment.



      The Java editor does not use tab characters. If a Java source file contains tab characters, they are replaced by the number of spaces specified here. A tab character entered via the keyboard is replaced in the same way.

      The indentation depth is used for automatic indentation of the Java source code, for example when inserting a control structure or a GUI component. By default, the indentation depth is 2.

      The width and height of new frame, JFrame and applet windows are defined here.

      You can set the standard character encoding of new source code files to ANSI, UTF-8 and UTF-16. Many text operations are fastest with ANSI encoding.

      • Indentation aid with tabulator - the tabulator key indents to the next word of the previous line
      • Automatic line indentation - the Enter key indents to the first character of the previous line that is not a space
      • The cursor may be to the right of the end of the line - the cursor can be placed after the end of a line
      • Automatically complete bracket} - if you enter a {character, the corresponding} bracket is automatically completed
      • Numbering lines - a newly created editor window shows line numbers
      • Show bracket structure lines - shows dotted lines between related brackets
      • Show pairs of brackets - if the cursor is in front of or behind a bracket, the corresponding other bracket is also marked
      • Show toolbar - shows the toolbar on the left edge of an editor window


      On this tab you activate the code completion and parameter notes and define their delay in milliseconds. You can change the font in the Code Completion window with the font-Select switch.

      Code completion and parameter hints are only available if the documentation is installed.


      You can select a GUI style and combine it with an editor style. Before selecting styles, you should open a Java source file so that you can see the styles live as you switch.

      You can also configure colors for the syntax highlighting of Java and HTML documents as well as for the bracket structure line and bracket pairs here.

      If you select a syntax element on the left, its foreground and background colors and text attributes are displayed. Then set the desired foreground color for this element with the left mouse button and the background color with the right mouse button. The desk default sets the standard colors and text attributes for all syntax elements.

      The GUI and editor styles are located in files in the styles folder of the Java editor. Additional editor styles can be defined in the DefaultColorsJava.ini and DefaultColorsHTML.ini files.


      Every new Java program is automatically provided with an introductory comment.

      The choices are:

      • JavaDoc - standard JavaDoc style as shown in the picture
      • In short - two lines with Author:% AUTHOR% and Date:% DATE%

      Write your name in the author field. It is used as the value for the% AUTOR% variable. The% DATUM% variable gets its value from the system date of your computer when the new file is created.


      There are many different views on what the template for a Java program should look like. If you agree to the templates used by the Java editor for console programs, frame, dialog and applet programs, leave the template settings free. Otherwise, take one of these templates, modify it according to your ideas and enter the modified template files on this page.

      In a template file you can use the variables% NAME% as the file name, as well as% AUTOR% and% DATUM%. The sign | specifies where the cursor should be after loading a template. For a template to work, it is important that it includes the Beginning and Contain lines marked at the end for inserting attributes, components and methods.

      You can also use a template file for the control structures. Since all control structure templates are in one file, keys of the type “#while” indicate the beginning of a template and the end of the previous template. It is best to adapt the downloaded sample file to your needs.


      The page keyboard shows the key assignment for the editor and the menu system.

      You can also select a file with keyboard shortcuts for code templates. In the templates subfolder of your Java Editor installation folder you will find a file JEKeyboard.txt, which explains how to define keyboard shortcuts for code templates. Use this file for your code templates.

      Additional keyboard shortcuts for the menu system can be found in the language file deutsch.ini To be defined.


      On the website Structograms the texts for the structogram elements, parameters for the control structures switch and for, as well as other settings configured.

      In the fields input and output are the texts that have to be used for converting an input / output into Java source code. The other texts are the templates for the structogram elements. In the for loop, the placeholders [i] = counter variable, [1] = start value, [n] = end value and [s] = step size are used.

      Number variables whose data type cannot be recognized from the structogram are given the type selected under data type by default when converted to Java source code.

      Sequence diagrams

      Lifelines are given the designation object with a number attached. New and Shut down are the messages for creating or closing a lifeline.

      In addition to the method name, the messages to a lifeline can also contain the parameter contain or the Return valueif the sequence diagram is generated using the debugger or a UML window.


      If Internet Explorer is installed, you can use it internally in the Java editor to display the documentation or to run applets. The internal mode is only available for Internet Explorer but not for other browsers such as B. Mozilla, Firefox or Opera are available. For example, you can use Internet Explorer to display the documentation internally and Mozilla Firefox as an external browser for testing applets.

      Activate only use one browser windowif only a single browser window is to be used in total.

      If a browser is to be used externally, select the desired browser under external browser. In addition, the browser title and buttons for Open address necessary in the browser. The Java editor first checks whether the external browser has already been loaded. To do this, he needs the browser title, for example Mozilla Firefox, Internet Explorer or Opera. If it is already loaded, the HTML page to be displayed is entered in the address field that opens via the file menu of the browser with the Open command. To do this, use Ctrl + O to select the command to enter / open an address.

      Activate if necessary Use proxy and then enter the IP address and port of the proxy. An activated proxy is used for the update function and code completion for http access to the documentation.


      The Java documentation is not part of the JDK and must therefore be installed additionally. The installed documentation enables easy access to the API documentation. Press the F1 key to get the documentation for the text where the cursor is located. The documentation is also required for code completion and the parameter notes.

      The original Java documentation from Oracle currently comprises more than 250 MB in around 10,000 files. At https://javadoc.allimant.org/ you can get the entire documentation in a single CHM file with only around 50 MB, but only up to version 8. Choose chm from the manual-Selection field, then you can have the CHM file installed automatically. We particularly recommend using the CHM file if you have installed the Java editor as portable software on a USB stick. Check that you can also double-click the CHM file to open it from the desktop. You may have to allow opening.

      As a makeshift, direct online access to the API documentation can be configured without any installation. To do this, use http addresses such as https://docs.oracle.com/en/java/javase/15/docs/api/index.html. In this case, the downloaded documentation files are cached, i.e. saved locally.

      The Tutorial exists as

      In addition, the installation of the Java book makes sense.

      The CacheFolder is used for direct http access to the Java documentation, Keep searching used to search the Java documentation.


      On the website printer determine the print margins, define the header and footer and determine the use of line numbers.

      The header and footer are divided into the three areas left, middle and right, which are printed left-justified, centered or right-justified. The areas are separated by the # sign. In addition to fixed text, you can also use the following variables in the header and footer:

      % File% the file name% path% the file name including directory path% date% the print date% time% the print time% page% the number of the print page% page number% the total number of print pages


      The Lego Mindstorms models can be programmed with Java programs. To do this, you need to install the Lejos system. If you do that through the To installSwitch, the Lejos documentation is installed at the same time.

      You can create a special template file for Mindstorms programs and enter it here. The same variables apply to this template file as to the other template files.

      Select the port for the infrared transmitter, usually USB, and your Mindstorms model RCX, NXT or EV3.

      With the switch Mindstorms mode toggle the Java editor. Then

      You can find examples of lessons at lehrer-online. You can find concepts for integrating LEGO Mindstorms in the classroom on Roberta - Learning with Robots.

      For the parallel use of the Java editor in normal and Mindstorms mode in a school, a copy of the JEMachine.INI is created for Mindstorms use. The Mindstorm parameters are configured in this JEMachineMindstorms.INI.A link to the Java editor is then created on the student's desktop and JEMachineMindstorms.INI is used as a call parameter.

      As of JDK 9, the compiler parameter used by Lejos -bootclasspath no longer supported. When compiling you get the following error messages:

      error: option --boot-class-path not allowed with target 9 error: option -extdirs not allowed with target 9

      Open the batch file to compile and replace at the end

      "% JAVAC%" -bootclasspath "% NXJ_CP_NXT%" -extdirs ""% *


      "% JAVAC%" -classpath "% NXJ_CP_NXT%"% *


      For the simple Android support described under Android, select the Android JDK path here and switch the Java editor to Android mode.


      Since the Java editor is a German production, the German language file deutsch.ini does not need to be specified. However, you can use the language file to effect other designations in the program.

      To create a new language file, make a copy of the english.ini file, name it according to the new language and select it as the new language file. If you open this new language file, you can see that the lines have the structure Name = value to have. Translate the values.

      The Translate-Switch supports the creation of new language files. It compares your language file with the english.ini file and marks all lines that are the same in both files. Identical lines have not yet been translated or sometimes should not be translated. The markings can be removed with Replace from the Edit menu.

      The Text Comparison tool from the Tools menu is suitable for updating a language file. This compares the old with the new version.


      You can make various settings on this page:

      • Load files on startup - opens all recently used files
      • Monitor external changes to files - checks whether loaded files have been changed by external programs
      • Save As renames the class - when you save a class with a new file name, the name of the class is changed accordingly
      • Create BAK files when saving - creates backup files when saving files
      • Name GUI components according to the “Text” attribute - if you change the Text attribute in the Object Inspector, the name of the GUI component is set accordingly
      • Use the interpreter window as a console for console programs (not for JavaFX) - The input / output takes place in the interpreter window of the Java editor, not in a separate console window
      • Use the batch file RunJava.bat to start console programs - by default the batch file RunJava.bat is used, which has a PAUSE command at the end so that the output can be viewed on the console. If the use of batch files is blocked, you deactivate this setting and close your console program with an InOut.readln ();

      • accept the default name when saving
      • strict Java in interactive windows - instructions must be entered in interactive mode with a semicolon at the end.
      • Permanently display hints in GUI designer - display information on GUI components when moving the mouse over them
      • Log Debugger - logs the debugger output to a text file
      • Translate compiler errors - in the editor window the marks for compiler errors show translated texts.
      • additional file filters - the open dialog also shows files that match the additional file filter
      • Font size in component bar - set the desired font size for the component bar, the standard size is 9
      • Temporary files folder - this folder needs write access, use default


      For security reasons, the use of DOS windows and Internet access can be deactivated in the Java editor. In addition, all configuration paths can be blocked.


      By default, the file extensions .java (Java source code), .jfm (GUI form), .uml (UML file), .jep (project) and .jsg (structure diagram) are linked to the Java editor. You can click on further extensions or in text form and through; enter separately. Extensions can be added or deleted using the “Change” button.

      “Linking the Java Editor” shows the current path of the Java Editor.


      On this page you configure the layout of classes and objects for the UML window.

      As a visual feedback, classes with a valid or no longer valid .class file are differentiated by color. If a java file is changed, e.g. an attribute is added, the class file, which is needed for the interactive work in the UML diagram, is no longer valid and is displayed with a red head. By compiling the Java file, a class file is created which then also contains the additional attribute. The head of the class is shown in white and you can create objects of the class again. You can compile a class using the context menu in the UML window.

      In the “Attributes and Methods” area you define the standard display for attributes and methods. This includes which ones are displayed at all, the order, the level of detail for parameters and the visibility.

      UML options

      There are a number of options for displaying classes and objects in the UML window and for converting classes into Java source code.

      Class representation

      • Show empty attribute and method rectangles - if there are no attributes or methods in a class, the relevant rectangles can be shown or hidden in the class diagram
      • Return value void use - methods with no return value are used with void shown
      • Integer instead of int - the data type int becomes UML-compliant with Integer designated
      • begin with the data type - in conformity with UML, a parameter begins with the name followed by the data type. In Java, the data type comes before the name of the parameter.
      • Show constructor with visibility - Constructors can be shown with a C or, as with methods, with visibility
      • Display class parameters separately - in the case of a parameterized class, the parameter can be shown indented at the top right
      • Role hides attribute - role names of a class relationship can hide attributes of the same name

      Object presentation

      • Show objects with inherited private attributes - In the case of objects, inherited private attributes are also shown with their values
      • Show objects with methods - normally you only show objects with their attributes and attribute values
      • Relationship attributes in bold - for class relationships, the relationship attributes are shown in bold
      • Start object names with lowercase letters - automatically generated object names start with lowercase letters
      • show all new objects - if a constructor or a method is called, all new objects created in the process can be displayed automatically
      • without visibility - attributes of objects are displayed without visibility

      Class editing

      • Standard modifier for attributes and methods - sets the visibility in the class modeler public, the kind of method on procedure and selects the get method for attributes
      • Open only public classes - when opening files in the UML window, the private classes contained therein are not displayed
      • Setter without this - defines how set methods are implemented or

      Object processing

      • private attributes editable - an object's context menu allows attributes to be edited, but you can exclude the private attributes
      • Attributes begin with a, parameters with - an option for generating the source code with the class modeler
      • Output function values ​​in the interpreter window - or in a separate function value window

      Type binding

      A generic class has a type parameter that can be viewed in the top right corner. You can add a type binding by double-clicking the type parameter.

      In this example is ContentType the type parameter and athlete the type binding.


      Here you can specify which tabs, components are displayed on the tabs, menus, and toolbars.

      You can hide entire tabs or individual elements on a tab. Select the tab you want to see its items. By default, the tab is layout, the Components menu and the toolbar Border layout switched off.

      In a PC room you can achieve a reduced availability of tabs, components, toolbars and menus on all PCs. The prerequisite is that you have installed the Java editor as recommended in a PC room using INI files. First, use the “Output” button to output the configuration data. You can find the visibility settings in the form

      [Visibility] Tabs = 111101111 Program = 11111111111 AWT = 111111111111111111 Swing1 = 1111111111111111111 Swing2 = 11111111111111111111 Layout = 111111 Utilities = 111 FXBase = 111111111111111111111 FXBase = 11111111111111111 FXControls = 11111111111111111 11111 Shapes = 11111111111111111 Toolbars = 11111111111111111

      Copy this into the JEMachine.INI file or into a z. B. Teacher- or room- or course-related INI file with which the Java editor is then called. The easiest way to do this is if the Java editor is started from a server, because then you only have to change a single JEMachine.INI file.


      You can have logs of compiler calls, errors in interactive work in UML windows and the Java editor exceptions.

      Select the log files here. You can use the variable% USERNAME% in the paths, for example:

      C: \ Users \% Username% \ AppData \ Roaming \ JavaEditor \ Log \ JELogfileExceptions.txt

      Assuming the required write access, you can save the logs centrally on a server in a PC room.



      Git is a version management system for files that supports working with local and server repositories. It is used to manage versions of source files.

      The Git homepage is at https://git-scm.com/.

      The folder of the previously installed Git is entered under Git folder. Repository local is the folder for the local repositories. A remote repository can be cloned. The name of the repository is then appended to Repository local.

      After the installation, the Tools menu is expanded to include a Git menu. In an editor window you call git commands via the context menu.


      JUnit is a framework for testing Java programs.

      The JUnit homepage has the address: https://junit.org/junit5/

      To be able to use JUnit, you have to install a junit-platform-console-standalone jar file. After installing this jar file, the Tools menu is expanded to include the JUnit menu. The easiest way to use JUnit is in a UML window. With a right click you can create a test class for a class. Depending on the configuration, this contains a BeforeEach and AfterEach method. With a test class, all tests or a test can be carried out via the context menu.

      If you start a test class from the editor window, all tests are also carried out.

      Check style

      Checkstyle is a development tool that helps a programmer to write programs according to given programming guidelines. More information is available at http://checkstyle.sourceforge.net/.

      Checkstyle and a programming guideline mycheckstyle.xml can be installed automatically. The programming guideline mycheckstyle.xml is not quite as strict as the programming guideline sun_checks.xml from SUN and is suitable for teaching.


      Jalopy is a formatter for Java source code. While Checkstyle only checks whether the programming guidelines are being adhered to, Jalopy reformats the source code according to the programming guidelines.

      Jalopy is offered in different versions on the homepage http://jalopy.sourceforge.net/. You need that for the Java editor Console plugin.

      The automatic Jalopy installation also installs the file myjalopy.xml with programming guidelines suitable for the Java editor. Run preferences.bat to change the programming guidelines.


      Subversion (SVN) is a version control system for files. It is used to manage current and previous versions of source files.

      The Subversion homepage is at http://subversion.apache.org/. Automatic installation cannot be offered because of the necessary e-mail registration.

      After the installation, the Tools menu is expanded to include a Subversion menu.

      Last modified: 2020/11/03 14:25 by