# Travis says jre is ver 11 but still won't run JAR of class file ver 55

**URL:** <https://travis-ci.community/t/travis-says-jre-is-ver-11-but-still-wont-run-jar-of-class-file-ver-55/11473>\
**Category:** Java\
**Created:** [April 19, 2021, 3:09am UTC](https://travis-ci.community/t/travis-says-jre-is-ver-11-but-still-wont-run-jar-of-class-file-ver-55/11473 "2021-04-19T03:09:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SolarUltima](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/solarultima/32/4019_2.png) [@SolarUltima](https://travis-ci.community/u/SolarUltima)\
**Post date:** [April 19, 2021, 3:09am UTC](https://travis-ci.community/t/travis-says-jre-is-ver-11-but-still-wont-run-jar-of-class-file-ver-55/11473/1 "2021-04-19T03:09:03Z")

</div>

i have Python application wired up to a Travis build. After the unit test run, I need to spin up the application and then run a JAR file to complete testing. The JAR file was compiled with Java 11 and is of class file version 55. In my build, I get the following exception:

```auto
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/myApp/main/Main has been compiled by a more recent version of the Java Runtime (class file version 55.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:756)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    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:418)

```

I want to check instance:

```auto
$ java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

```

So why is the exception acting like the Travis instance is running an earlier version of Java? I had this same problem locally and was able to fix it by changing my JRE from Java 8 to 11. is there a way I can change this in my .travis.yml file?

```auto
after_script:
  - chmod +x ~/build.sh
  - chmod 777 ./tests/LPT/myApp.jar
  - bash ~/build.sh
  - java -version # output of this is shown in question
  - sudo java -jar ./tests/solar/LPT/myApp.jar ./tests/LPT/input.json 

```

thank you,  
solarultima

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [April 19, 2021, 3:11am UTC](https://travis-ci.community/t/travis-says-jre-is-ver-11-but-still-wont-run-jar-of-class-file-ver-55/11473/2 "2021-04-19T03:11:58Z")

</div>

Hey @SolarUltima,

If you read the `manpage` on `sudo` you’ll find that the default policies generally clear a lot of environment variables for security reasons, (this happens automatically) and while you’re _building_ your application and running your `java -version` check with normal permissions, (without `chown/chmod`) you’re using `sudo java` to actually have it in runtime. You may be getting a different `PATH` and/or `JAVA_HOME` in the two environments.

See if that doesn’t help, if it doesn’t post back and I’d like to see some more log files.

Thank you,

Montana Mendy
