Code Editor & Compilation Settings

## Code Editor & Compilation Settings |

| The choice of a JDK can be changed on a per session basis. By default, the JDK that you configure in the general settings is used. You can select a different JDK on this tab that will only be used for this session. The selected JDK will be used for code completion in the script editor and scripts will be compiled against this JDK. It is recommended that the JDK is compatible with the JRE of the profiled application, otherwise you might accidentally use methods that are not available in the profiled application.

| When you profile a JVM with the JProfiler GUI, JProfiler compiles scripts on the fly according to the auto-detected Java version in the profiled JVM. For scripts in the session settings, such as the custom probe configuration, scripts are compiled when you save the session. In that case, the version of the selected JDK configuration is taken. Here, a problem arises if the configured JDK has a different version than the actually profiled JRE. Apart from selecting a wrong JDK for the session, this may also be the case in remote profiling, when you do not have a suitable JDK at hand. Once you connect to the profiled JVM, the scripts will be recompiled in the appropriate class file format. This recompilation is not necessary if you adjust the target JRE version explicitly on this tab. An accurate selection is critical for offline profiling, where no recompilation can be performed in the case of a mismatch between the class file format of the pre-compiled script classes and the version of the profiled JVM.