CIT 594: Forté FAQ
Dave Matuszek

Win extra credit! If you are the first person to submit a problem and its correct solution, and I add it to this FAQ, you can win 5, 10, even 15 points!

Entries will be judged on whether I think the solution is correct, is sufficiently non-obvious to be worth adding to this FAQ, and is explained clearly enough for me to understand. Good spelling and grammar are optional.


General information


My files disappeared (or are zero length)!

There is a very bad interaction between Forté and Linux when you have exceeded your disk quota. Apparently, the system issues an error message, but Forté doesn't pass it along to you.

For now, the best temporary solution seems to be (1) keep backups, and (2) don't run out of disk space. Remove your MP3s and other large but unnecessary files (you can see the size of your files with the ls -l command). Remove any core files. Then, log into eniac and run the command raisequota. You can check your current disk usage with the quota command.

I'm trying to find a better, more permanent solution.

Why can't Java find my main method? I keep getting java.lang.NoSuchMethodError: main
Exception in thread "main"

There are several reasons this might happen.


My project is an applet, but I get a java.lang.NoSuchMethodError: main error.

From Tsung-Fang Tu: Forté keeps track of whether you have an application or an applet, but (for some as yet unknown reason), sometimes it forgets. To tell it that your project is an applet:

  1. In the Explorer Window, right click on your applet class and choose Properties. The Properties window will pop up.
  2. Choose the Execution tabbed pane on the buttom of the Properties window.
  3. Change Debugger property to Applet Debugging.
  4. Change Executor property to Applet Execution.

I created an applet, and Forté gave me two files with the same name.

Applets must be run from an HTML file. By default, Forté gives your HTML file the same name as your Java source file, but with the .html extension instead of the .java extension. If you look closely, you will see that the icons are different--the .html icon has a tiny globe on it, while the .java file has some sort of red blobby thing on it.

My editing changes keep disappearing.

The Explorer [Filesystems] window lists all the directories and files that Forté can access. If you have older versions of your files somewhere in a mounted filesystem, Forté may well try to compile and use those files as well. If the old versions of the files are in the same directory, move them somewhere else; if they are in a different directory, unmount that directory.

Forté has a much nicer way of keeping track of old versions, called CVS (Concurrent Versions System). CVS isn't just a Forté thing, it's the most popular versioning system on Windows. CVS is moderately complex, but (like any good tool) learning to use it is worth the effort.

When I try to run my program, it says my class has the wrong name.

The message you get is something like java.lang.NoClassDefFoundError: myClass (wrong name: myFolder/myClass). Actually, this is telling you that your package name doesn't agree with the name of the directory your file is in. There are two possible solutions: (1) learn the rules for package names; the rules are very simple, but in practice it isn't always easy to get it right; or (2) just delete all the package declarations and throw away the backup file (the one ending with a ~). If you don't throw away the backup file, the package directive seems to keep coming back--I don't know why. For an applet, you should also correct the HTML file.

I get cannot resolve symbol errors for normal Java classes, like Button or Color.

You probably forgot to import the appropriate packages. Forté doesn't import any packages; instead, it uses the fully-qualified names (java.whatever). You can import the classes or packages yourself (import statements go after the package statement, if there is one), or you can use the fully-qualified names. Or both--it's legal to mix the two styles.

Where are all my Forté windows?

When you move from one tabbed pane to another in Forté's main window, various other windows open and close. The first thing to do is to check whether you have the right tabbed pane open.

Just about every program in the world has a Windows menu. Forté is no exception, but unlike other programs, this menu only shows you the windows that are already open, which is helpful only in bringing a window to the top if it is buried under other windows. The menu you probably want is View, from which you can open most windows. Unlike other programs, this menu doesn't have checkmarks to tell you which windows are open; but choosing an already open window from the View menu does not close that window, so it doesn't hurt to try.

There is no installed server. The execution/debugging is not allowed

This sometimes happens when the HTML window is foremost. Bring another window (such as your source code) to the front, and try running again.

I closed my Form window, and now I can't get it back.

From Ming-Yi Shiau: If you close your Form editor in the GUI Editing mode, the next time you switch back to GUI Editing mode, the Form editor won't show up as usual, and you cannot find it in the View menu either. The solution is simple. Choose View -> Component Inspector, and within the Component Inspector window, right-click the topmost icon in the upper pane of the window, then choose Design This Container.

Some windows quit responding to mouse clicks.

I think this is a memory problem. At least once when this happened, other windows gradually became frozen as well. Restarting Forté solves the problem; running with fewer other applications open at the same time seems to prevent the problem from occurring.

All but one panel of my GUI disappeared from the Form window.

You probably double-clicked on it by accident. Right-click on it and select Design Whole Form.

Java causes invalid page fault in module Kernel32.DLL - Windows 98

From Tao Feng:
Whenever I accessed the Swing library, Windows 98 returned an "invalid page fault". Programs that do not use Swing worked fine. I found the following support document on Sun's support site and resolved the issue by disabling Microsoft Office Quick Start.
Document ID ee6f93d
Synopsis Java causes invalid page fault in module Kernel32.DLL - Windows 98
Date 4 Jan 2002
Description Java causes invalid page fault in module Kernel32.DLL - Windows 98

Solution Summary

This is the JVM aborting because of memory corruption, usually caused by a 3rd party program loaded during Windows 98 startup. The solution is to identify the offending program and disable it. If you disable everything you don't need, then you will probably fix the problem. Also, disabling unneeded programs from Windows 98 startup improves overall system performance. Here's how to do it...

  1. Start Menu | Programs | Accessories | System Tools | System Information
  2. In the Microsoft System Information window, open Software Environment | Startup Programs
  3. Identify programs that are not needed. In particular, this problem has been cured before by disabling Microsoft Office Quick Start.
  4. In the Microsoft System Information window, Choose Tools | System Configuration Utility | Startup and clear checkboxes to disable programs
  5. Restart Windows 98.

My applet works in Forté but not in my browser.

You are using (or possibly Forté is using) some Java call that your browser doesn't understand. You should use AWT for applets; Swing is less likely to be understood by browsers. If you are not using Swing, the problem is probably in code that you added. Open the Java Console window so that you can view the error messages, and look for a NoSuchMethodError. To open a Java Console window, do this:

Netscape 4: Choose Communicator -> Tools -> Java Console.

Internet Explorer 5: Every minor version of Internet Explorer does this in a different, hard-to-find place; try Tools -> Internet Options -> Advanced -> Java console enabled (requires restart). Then restart Windows (restarting IE is not enough). Reopen IE and choose View -> Java Console.

After jarring and unjarring my files, my program no longer works in Forté.

Forté creates and uses a file named .nbattrs. Under UNIX (or when you telnet to UNIX), this file is invisible, and neither * nor *.* will capture it. You can either add it to the jar explicitly (by including it on the jar command line), or you can move up to the enclosing directory, and jar the entire program directory.

My program is stuck in an infinite loop; how do I make it stop?

If you are debugging the program, go to the Debugger Window and choose the Sessions tabbed panel. Right click on the session (it's probably the only thing in the left pane, and should be marked (Running)), and choose Finish session.

If you are only running (not debugging) the program, go to the Execution window (if it's not open, open it from the View menu). Right click on the process (it's probably the only thing in the window) and choose Terminate process.

The Reformat Code command doesn't work.

This command only works when entire lines are selected, not partial lines. The easiest way to select entire lines is to click and drag in the gutter (where the line numbers are).

The font (or color) in the editor is hard to read.

From Tsung-Fang Tu: You can change the fonts, styles, and colors for the editor as follows.

  1. Choose Tools -> Options... from the main menu.
  2. Expand Editor Settings (click on the "key" next to it) in the Options window.
  3. Select Java Editor.
  4. To change the font size for everything, just change the Font Size value in the right pane.
  5. To change the font characteristics for a specific syntax (such as block comments), click on Fonts & Colors, then click on the ellipsis (...) that appears next to it.
  6. Pick a syntax (such as Block Comment, which is a light gray italic), and change the font, size, and/or color. If you change the color, note that you get a tabbed window (with tabs along the top) that gives you many different ways to choose the color.

Most changes happen immediately. You can't scroll the Source Editor window while you are changing options, so it is helpful if you first make sure the text you want to change is visible before you open the Options window.

I can't get Forté to generate javadoc documentation for my tags or private members.

From Tien-chi Pan:
  1. From the top-most menu, choose Project -> Settings.
  2. In the Project Settings window, click on Documentation on the left.
  3. On the right, change Javadoc Executor Type to Internal Javadoc.
  4. Change Ask for Destination Directory to true, so that you can specify where to put the Javadoc each time it's generated.
  5. Double-click on Javadoc Executors on the left to show its subnodes.
  6. Click on Internal Javadoc, and change Members on the right to private.
  7. In the right pane, click on Doclets to get the ellipsis (...) button. Click on it.
  8. Change Author from false to true. Do the same for Version. Click OK.
  9. Close project settings and you're done.

To generate Javadoc for all the classes in a directory, right-click that directory in the Explorer window to bring out a menu and elect Tools -> Generate Javadoc. Right-clicking on a single class in the Explorer window will generate Javadoc for that class only.

Note: Forté uses the external javadoc executor by default. Although we can change the Members options for the External Javadoc Executor to private, it will not work unless we change the Javadoc Executor Type to Internal Javadoc Executor first and then change it back to External Javadoc Executor.

Note #2: The internal Javadoc executor is not recommended for large amounts of code (such as the entire JDK) unless you have at least 256MB of RAM. This should not be a problem for our programs, though, and I have had better luck with the internal executor.

How do I create a TextArea without scrollbars?

From Tien-chi Pan:
When you create a GUI Component in Forté, it uses a default constructor. You can tell Forté to use a different constructor as follows:
  1. Create the component.
  2. Click on the Component and go to the Component Inspector window.
  3. Choose the Code Generation tab at the bottom of the window.
  4. Click to the right of the Custom Creation Code button.
  5. Type in the constructor you want to use. For example, to eliminate scrollbars from a TextArea, enter a constructor call such as new java.awt.TextArea("text", 10, 40, java.awt.TextArea.SCROLLBARS_VERTICAL_ONLY); (don't forget the semicolon).

How do I provide arguments to a main method?

From Rajani Kutty:
Select the class which has the main method. From the main menu choose Build--->Set Arguments and then type in the arguments as you would type them on the command line. If an argument includes a space, enclose it in quotation marks. Then click OK.

General information

Can I bring BlueJ projects into Forté?

Yes. Use Forté's File -> Mount Filesystem... command to select the folder containing all your BlueJ files. Forté will not know about your GUI, so you won't be able to make any changes to it in Forté; despite that, everything will work.

Can I bring Forté projects into BlueJ?

Yes. Use BlueJ's File -> Open Non BlueJ... command to choose the folder containing all your Forté files.

In BlueJ's main window, it marks applets with an <applet> tag. If your applet isn't so marked, you can't run it as an applet. The solution is simply to recompile it.

If you get a message (from either system) saying that the class has the wrong name--myProject instead of myProject/myClass--the easiest solution I have found is to remove all the package directives, save the file, then throw away the backup file (the one ending with a ~). If you don't throw away the backup file, the package directive seems to keep coming back.

Can I go back and forth between BlueJ (or some editor) and Forté?

Yes, but it's not a good idea.

In BlueJ (or any other editor) you will see //GEN-BEGIN and //GEN-END comments; these mark regions that you should not edit. These are the regions that show up as light blue areas in Forté. Any changes or additions you make in this block of code will disappear permanently the next time you use the file in Forté. There are also //GEN-FIRST and //GEN-LAST comments; you should not edit the lines on which these occur.

You can add and change code outside these regions. If you add any code that Forté normally generates, such as GUI code, Forté will not recognize it and "adopt" it (for example, if you create a new Button, Forté's Form window won't display it), but the code will still be there and will still function normally.

Can I look at the Java API from within Forté?

Yes and no. That is, you can get to it from within Forté, but Forté opens a browser to show you the files.

To set this up, you should have the Java API documentation downloaded to your computer (this is a good idea in any case). Use the Javadoc tabbed pane in the Explorer window. Right-click on Javadoc in this window, and choose Add Directory... (if you have unzipped the API file you downloaded), or choose Add JAR... (if the API file is still a jar or a zip file). Find the file or directory, select it and mount it.

The advantage of keeping the file zipped is that it uses much less disk space. The disadvantage is that opening a zipped file directly from Internet Explorer is slow and painful (but seems to work fine from within Forté.)

Where are the import statements?

Forté uses fully-qualified names instead of import statements. For example, where you might import java.awt.* and later say Button myButton;, Forté will say java.awt.Button myButton;.
You can add import statements if you like; it doesn't hurt to mix fully-qualified names and import statements in the same class. Remember that import statements must be the very first things in the file, after the package statement (if there is one).

Why does Forté declare variables at the bottom of the file instead of the top?

This is actually a fairly common style, and is perfectly legal in Java, but it's a style I don't particularly like. You can either (1) put your variables down there also, in order to maintain a consistent style, or (2) put your variables at the top, because those are the ones that you, rather than Forté, are responsible for (so they probably should be in different places). At the moment I have a mild preference for the latter, but it's up to you to decide what style you prefer.

I want to look at two files at once.

From Kit Marlow: You can look at your project's files side-by-side, rather than switching between overlapped files, by "cloning" one of them. You can do this by right clicking on the desired file's tab at the bottom of the Source Editor window, and selecting Clone view. A copy of the file will appear, and you can size it or situate it however you like.

How do I quickly jump to the next syntax error?

From Kit Marlow: A good way to see the errors in the output window and in your code at the same time is the NextError function (press F12). This function allows you to jump from error to error in both windows simultaneously, with the offending lines highlighted in both. Hitting the shift key plus F12 (PreviousError) does the same thing, except in the reverse direction. I find this easier than going between the output window and the source editor window for each error.