jGRASP FAQ

  1. Why won't my program compile?
  2. What happened to pcGRASP and UNIX GRASP?
  3. Which jGRASP version should I download?
  4. Which Java version should I use / am I using?
  5. How can I set command line arguments for the program I'm running?
  6. How can I set compiler flags?
  7. Why does the keyboard focus change when I move the mouse over a window?
  8. How can I make more room for the debugger window?
  9. How can I use Ctrl-d, Ctrl-c, "cls" etc. for a running program?
  10. Why do I get a "FATAL ERROR in native method: No transports initialized Transport dt_shmem failed to initialize, rc = 509." message when debugging Java or starting the workbench?

1) Why won't my program compile?

jGRASP does not contain and is not delivered with any compilers. If you get an error message indicating that the compiler was not found, make sure you do have a compiler installed.

jGRASP is set up by default to run a Java SDK compiler for Java, a gnu-style compiler for C and C++, etc. A different compiler may be selected by choosing a different compiler environment (or creating one if it does not exist). To choose one, select Settings > Compiler Settings > Workspace or Project, depending on whether you want use the compiler for all projects or just the current project. Select the appropriate language for your code. Select the Environment tab. Select an environment and hit Use. Hit the OK button. If you need to create a compiler environment, search the jGRASP help for Compiler Environments.

Generally, the executable for the compiler must be on your system's path, or on a path added by jGRASP. Having it on your system path means you can also use the compiler from the command line or from a DOS shell. Having it only in jGRASP allows you to use different compilers (such as different Java versions) easily. A compiler may "add itself" to the system's path when installed, or it may not. Follow these instructions to add a path only in jGRASP or for the system.

To add a directory to the path only in jGRASP:

Select Settings > PATH > CLASSPATH > Workspace or Project, depending on whether you want use the compiler for all projects or just the current project.

Add the new directory to the PATH (upper) window.

Hit OK.

To add a directory to your system's path: on Windows NT/2000/XP, Windows 98/ME, or Linux/UNIX

On Windows NT/2000/XP:

Go to Start > Control Panel.

On XP, Switch to Classic View if not already in classic view.

Double click System.

On NT, Click the Environment tab.
On 2000/XP, Click Advanced tab, then click Environment Variables button.

System paths will take precedence over user paths, and will apply to all users. If you are not a system administrator, you may not have access to system environment variables. In most cases, you should set the path at the user level if you are the only user who needs it (or the only user on the machine).

Select PATH or Path under user or system, and click Edit. If PATH or Path does not exist, click New and name the new variable PATH.

Add the new path to the beginning or end (or middle) of the current path, using a semicolon as a separator, or just set the path if it is new. For example, to add the typical Cygwin path, add ;C:\cygwin\bin to the end of the current path, or C:\cygwin\bin; to the beginning of the current path, or set the path to C:\cygwin\bin if it was previously empty. Directories that come first on the path are searched first when Windows is locating an executable, so adding to the beginning of the current system path may interfere with system commands, and should not be done unless it is absolutely necessary and you know what you are doing.

OK all the dialogs that are up.

On Windows 98/ME:

Edit your autoexec.bat file (you can use jGRASP, Notepad, or some other editor). Typically, this file is at C:\Autoexec.bat . Make a backup copy before you make any changes.

If autoexec.bat contains a set PATH line, add the new path to the middle or end (or beginning) of the path, using a semicolon as a separator. For example, to add the typical Cygwin path, add ;C:\cygwin\bin to the end of the current path, or C:\cygwin\bin; following some semicolon in the current path. Directories that come first on the path are searched first when Windows is locating an executable, so adding a directory before the first %PATH% in the path (which will initially contain the system path) may interfere with system commands, and should not be done unless it is absolutely necessary and you know what you are doing.

If there is no set PATH line, create one that includes %PATH%. For example, to add the typical Cygwin path, add the line set PATH=%PATH%;C:\cygwin\bin. You could also use set PATH=C:\cygwin\bin;%PATH%, but directories that come first on the path are searched first when Windows is locating an executable, so this may interfere with system commands, and should not be done unless it is absolutely necessary and you know what you are doing.

Save the edited Autoexec.bat file.

Reboot your machine.

On Linux or UNIX:

The best place to add to the PATH is in your login script. This is typically in your home directory. If your login shell is bash, the file is .profile or .bash_profile, for other login shells, the file may be .login, or something else.

If you see a command that modifies PATH in the login shell file, add the new path using a colon as a separator. Unless absolutely necessary, the new path should come after /usr/bin, and other system paths.

If you need to add a path command for an sh style shell (such as bash), add lines like (on some sh style shells you can set and export on one line), for example:

PATH=$PATH:/dir1/dir2/bin
export PATH

If you need to add a path command for a csh style shell, add a line like, for example:

setenv PATH $PATH:/dir1/dir2/bin

Save the edited login script file.

Log out and log back in.


2) What happened to pcGRASP and UNIX GRASP?

pcGRASP and UNIX GRASP are no longer maintained. jGRASP is more stable and has more features than the previous versions, so unless you have a very old (and slow) system, we recommend using jGRASP. The older versions are still available in the archive.


3) Which jGRASP version should I download?

If you are on Windows, get the jGRASP exe version.

For macOS, get the jGRASP pkg version.

On any other OS, get the jGRASP zip version.

If the installer for one of the self-installing versions does not work, please let us know. You can use the zip version on any system, just follow the instructions.


4) Which Java version should I use / am I using?

If you will be developing Java applications on a Windows, macOS, or Linux system, in most cases you should get the latest JDK from Oracle.

It is best to run jGRASP on the latest version of Java. If you need to compile and run programs on an older version, add the bin directory for the older version to the jGRASP PATH settings (click here for more information).

To see which Java version jGRASP is running under, hit Tools > System Info. To see how the Java version was chosen if you are on Windows, pop up the jGRASP Control Shell from the Windows taskbar.


5) How can I set command line arguments for the program I'm running?

Click Run > Run Arguments and enter arguments in the window that comes up. Arguments are separated by whitespace, and may be double-quoted to include whitespace. Use %" to enter a double quote, and %% to enter a percent sign. Note that Windows does not support multiple command-line arguments at the OS level - there is only one argument that is broken up to simulate multiple arguments as the target program sees fit. Not all programs agree on how to do this. For Windows, double quotes in arguments will be backslash-escaped and all arguments will be double quoted. This should be appropriate for most targets.


6) How can I set compiler flags?

Go to Settings > Compiler Settings > Workspace or Project depending on whether you want these flags to apply to all compiling, or just to the current project (you can also set compiler flags for individual files - use Edit > Compiler Settings > File from an editing window). Select the language you are using, then select the Flags/Args/Main tab. Click off the default box for FLAGS in the row corresponding to the compile command you are interested in, and enter the flags in the text box. FLAGS2 is used when there are two sets of flags - when running Java for example, FLAGS are flags to the target application, and FLAGS2 are flags to Java itself.


7) Why does the keyboard focus change when I move the mouse over a window?

A partial focus-follows-mouse system is implemented in jGRASP. You can turn this off under the Settings menu. If it is on, the keyboard focus will be in the window the mouse is over (but clicking in a virtual desktop window still pop it up - that is why it is partial focus-follows-mouse). Focus-follows-mouse is available system-wide on many non-Windows systems, and most experienced users find it more productive than click-to-focus. It allows you to read one window at a large size while typing into a window that is behind it and has just a sliver visible, and to quickly slide from one window to another and execute a command pertaining to that window, without wasting the time necessary to pop it to the top. The downside is that you may sometimes type into a window you did not mean to type into, especially if you are not used to the system. In a true focus-follows-mouse system, you can also click in a window and use menus without popping it up; only clicking on the title bar or border will raise it. True focus-follows-mouse in a virtual desktop under Java is at best impractical to implement, and may not be possible without creating a new Look-And-Feel.


8) How can I make more room for the debugger window?

Turning on Settings > Full Height Tab Pane will reorganize the main jGRASP window so that the tab pane on the left occupies the full height of the window.


9) How can I use Ctrl-c, "cls" etc. for a running program?

The jGRASP Run I/O window does not support many system specific console/shell commands/signals. The Run I/O window context menu has items for entering EOT (Ctrl-D or End of Transmission) and for closing the input stream. More functionality may be added in the future. In Windows, you can run your programs in a DOS shell from jGRASP by turning on Run > Run in MSDOS Window. On other systems, you will have to run from the command line if you need those functions.


10) Why do I get a "FATAL ERROR in native method: No transports initialized Transport dt_shmem failed to initialize, rc = 509." message when debugging Java or starting the workbench?

If you are running Java under a Java sdk or jre that does not include dt_shmem.dll and/or dt_socket.dll, you may get the message

FATAL ERROR in native method: No transports initialized
Transport dt_shmem failed to initialize, rc = 509."

or

FATAL ERROR in native method: No transports initialized
Transport dt_socket failed to initialize, rc = 509."

Most likely you are running under a JRE delivered with another Java application, or some non-standard version of Java. To find the location of the java that is running, turn on Settings > Verbose Messages and (attempt to) debug. The full path to the java command will be shown as "actual command sent". To fix the problem, either adjust your system PATH to remove the path to the problem JRE, or select one of the compiler environments with "prefer JDK compiler" in the name (those will use the same java that jGRASP is running under to run user programs).