# What is the correct way to make a kernel use a different JVM?

**URL:** <https://discourse.jupyter.org/t/what-is-the-correct-way-to-make-a-kernel-use-a-different-jvm/32648>\
**Category:** Kernels\
**Created:** [February 10, 2025, 8:26am UTC](https://discourse.jupyter.org/t/what-is-the-correct-way-to-make-a-kernel-use-a-different-jvm/32648 "2025-02-10T08:26:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![waldhol](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/waldhol/32/17308_2.png) [@waldhol](https://discourse.jupyter.org/u/waldhol)\
**Post date:** [February 10, 2025, 8:26am UTC](https://discourse.jupyter.org/t/what-is-the-correct-way-to-make-a-kernel-use-a-different-jvm/32648/1 "2025-02-10T08:26:38Z")

</div>

I have installed the sysml-v2 kernel from here: [SysML-v2-Release/install/jupyter/README.adoc at f49ea19a807a2aa45ad1afed0ed62afe41aabdf9 · Systems-Modeling/SysML-v2-Release · GitHub](https://github.com/Systems-Modeling/SysML-v2-Release/blob/f49ea19a807a2aa45ad1afed0ed62afe41aabdf9/install/jupyter/README.adoc)

The installer automatically installed a recent JVM.  
When I run `echo %JAVA_HOME%` at the prompt, I get the correct answer `C:\Tools\anaconda3\Library\lib\jvm`.

But when I start `jupyter lab` from this same prompt, I get the following error:

```auto
[I 2025-02-10 08:18:29.600 ServerApp] Kernel started: a1761d55-3b26-42a6-b14b-34235c534b96
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/omg/sysml/jupyter/kernel/ISysML has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:365)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:621)

```

It looks like the kernel does not respect the `JAVA_HOME` variable and is using the globally installed version 8 JVM instead of the more recent local JVM.  
I cannot change this global version 8 JVM installation as I am working in a corporate environment.

What is the correct way to make the kernel use a different JVM?
