Troubleshooting Java Applications

Applies to TestComplete 14.93, last modified on September 16, 2021

This topic lists typical issues you may experience when testing Java applications with TestComplete and provides possible solutions to these issues.

TestComplete cannot get access to a Java application’s internals

TestComplete cannot get access to internal methods and properties of Java objects if the tested application was launched with the -verbose or -verbose:class command-line argument. To resolve this issue, launch your application without these arguments.

Tests are played back incorrectly when using the Windows look and feel

If your Java application uses the Java Swing ComboBox, Java Swing List or Java Swing Tree control and the com.sun.java.swing.plaf.windows.WindowsLookAndFeel look and feel, launch your application with the swing.disablevistaanimation command-line parameter set to True, or specify the parameter in the application code. Otherwise, errors may occur when playing back your tests.

Here is an example of how you can specify this parameter:

java.exe -Dswing.disablevistaanimation=true -cp MyApp.jar MyApp.Main
An exception occurs when debugging a Java application

When you are debugging a Java application and TestComplete is running, an exception may occur in the application. When getting access to internal methods and fields, TestComplete may load classes to memory and the debugger may fail to find the appropriate class reference. To resolve this issue, do not debug your application when TestComplete is running, or do not run your application under a debugger.

The "Could not create the Java virtual machine" error message is displayed

During automated testing, when you start a Java application with JDK (or JRE) v. 1.6_18, the "Could not create the Java virtual machine." error message may be displayed. The problem is caused by insufficient memory allocation. 256 Mb of memory is sufficient for a Java application, but the Java 1.6_18 build apparently requires more memory. Since TestComplete loads its helper modules to the address space of the tested application, the application’s memory consumption increases. So, loading additional modules to the application sometimes can lead to exceeding the 256 Mb bound. To avoid this problem, it is recommended to update the Java console with the -Xmx512M parameter to increase memory allocation to 512 Mb.

TestComplete does not record actions with the Java AWT popup menu

Due to specifics of the AWT library, TestComplete cannot record actions with menu controls of the java.awt.PopupMenu class. You can resolve the issue by writing the needed script code manually or recording the needed actions with the Java Application Support plugin disabled. Another possible workaround is to use javax.swing.JPopupMenu menus instead of java.awt.PopupMenu in your application.

See Also

Recording Automated Tests
Recording Options Dialog
Recording Specifics

Highlight search results