Author Topic: "class file wrong version" Error when building PTL Trader app  (Read 4204 times)

Allen Kim

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
I am trying to install PTL Trader, what I did is I clone the project from GitHub, installed jdk 1.8.0_321 and jre1.8.0_321.
Then i tried to build the project following the guidance by running below command:
bash ./gradlew shadowJar -PforceArch=win64    (btw i am using window10 os)

Then I got this werid error:

import org.eclipse.core.runtime.IStatus;
                               ^
  bad class file: C:\Users\allen\.gradle\caches\modules-2\files-2.1\org.eclipse.platform\org.eclipse.equinox.common\3.15.100\498abfe26a551e844909c745c2936f6578ad81e5\org.eclipse.equinox.common-3.15.100.jar(org/eclipse/core/runtime/IStatus.class)
    class file has wrong version 55.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.
:compileJava FAILED

anyone can help me on this ?

admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 338
  • Karma: +13/-0
    • Pair Trading Lab
Re: "class file wrong version" Error when building PTL Trader app
« Reply #1 on: March 05, 2022, 03:53:58 pm »
Confirming the issue.

Unfortunately this is a standard Gradle dependency hell situation. Some package was updated and some transient package (org.eclipse.equinox.common) is in the new version compiled with Java 11, so it does not fit rest of the application and build fails. I guess, already had few issues like this.

The solution is to fiddle with version specifiers and downgrade packages which need to be downgraded. Unfortunately I won't have time to look at it in few weeks.

Feel free to fix this yourself if you want to have it faster. If you submit a working PR to this issue I will provide 3 months of premium membership as a bounty.

Kind regards,
Karel

Allen Kim

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: "class file wrong version" Error when building PTL Trader app
« Reply #2 on: March 05, 2022, 06:48:11 pm »
I see, thanks for explaining. I am new to Grandle, will try to do some research and fix.




Confirming the issue.

Unfortunately this is a standard Gradle dependency hell situation. Some package was updated and some transient package (org.eclipse.equinox.common) is in the new version compiled with Java 11, so it does not fit rest of the application and build fails. I guess, already had few issues like this.

The solution is to fiddle with version specifiers and downgrade packages which need to be downgraded. Unfortunately I won't have time to look at it in few weeks.

Feel free to fix this yourself if you want to have it faster. If you submit a working PR to this issue I will provide 3 months of premium membership as a bounty.

Kind regards,
Karel

Allen Kim

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: "class file wrong version" Error when building PTL Trader app
« Reply #3 on: March 05, 2022, 09:46:23 pm »

I think i made it work but with a very ugly workaround, I manually downloaded org.eclipse.equinox.common-3.14.0.jar file renamed it to org.eclipse.equinox.common-3.15.100.jar and placed it under my directory: C:\Users\<your user name>\.gradle\caches\modules-2\files-2.1\org.eclipse.platform\org.eclipse.equinox.common\3.15.100.
At least it can build now.

But let's come back to the root problem, I know the problem comes from the version of "org.eclipse.equinox.common" library, seems newer version 3.15.100 is compiled with JDK11 instead of JDK8. But i see we already specified to use 3.14.0 version in the build.gradle file. Forgive me i am new to gradle, I don't understand why when i build it is still downloading 3.15.100 version (the latest version). Looks like some other libraries are depending on this latest version, so it got downloaded instead of version 3.14.0.

Is there a easy way to force use 3.14.0 then we can probably find and downgrade those libraries which depends on 3.15.100 version ?




I see, thanks for explaining. I am new to Grandle, will try to do some research and fix.




Confirming the issue.

Unfortunately this is a standard Gradle dependency hell situation. Some package was updated and some transient package (org.eclipse.equinox.common) is in the new version compiled with Java 11, so it does not fit rest of the application and build fails. I guess, already had few issues like this.

The solution is to fiddle with version specifiers and downgrade packages which need to be downgraded. Unfortunately I won't have time to look at it in few weeks.

Feel free to fix this yourself if you want to have it faster. If you submit a working PR to this issue I will provide 3 months of premium membership as a bounty.

Kind regards,
Karel

admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 338
  • Karma: +13/-0
    • Pair Trading Lab
Re: "class file wrong version" Error when building PTL Trader app
« Reply #4 on: March 07, 2022, 07:57:24 am »
> Is there a easy way to force use 3.14.0 then we can probably find and downgrade those libraries which depends on 3.15.100 version ?

It definitely is, but fiddling with Gradle documentation and hacking the version specifiers to accomplish this is exactly the work I don't have time for at the moment :( I will look on it in few weeks...

Another solution would be to get rid of pico, which prevents us to use newer Java in the project. Unfortunately that means migrating the project to another IoC solution (guava?), which is maybe one week of work...I think this is inevitable in long term...