Java Runtime Environment

This section is about programming for the JRE in C++ not in Java.

Installation

The JDK comprises the JRE, so no need to install it apart.

Windows

Download link : http://www.oracle.com/technetwork/java/javase/downloads/index.html. Choose JDK.

On 64 bits Windows, if you install both x64 and i585 version, the java command is always the x64 one.

If working under Cygwin, you can create aliases to easily switch between x86 and i585 version.

GNU/Linux (Debian)

The package to install is default-jdk.

Although it doesn't complain under Windows, under GNU/Linux the parameter of System.loadLibrary(…) should not contain a directory separator. So, the library should be found in java.library.path. The content of the LD_LIBRARY_PATH is part of this properties.

MacOS

Install the corresponding .dmg.

/usr/libexec/java_home displays the JDK root path.

Issues

'CTRL-C' on 'Cygwin'

CTRL-C is not handled correctly by the JRE under Cygwin (Cygwin doesn't pass the signal to the JRE), i.e. the hooks added with Runtime.addShutdownHook(…) are not called on CTRL-C. There are no known workaround.

https://stackoverflow.com/questions/11757643/