Class file has wrong version 55.0, should be 52.0

I am having an issue with building my program. I get a bad class file error

Buildfile: C:\Users\Cecilia\workspace\InfiniteRecharge_2020\build.xml
Trying to override old definition of task classloader
clean:
[delete] Deleting directory C:\Users\Cecilia\workspace\InfiniteRecharge_2020\build
compile:
[mkdir] Created dir: C:\Users\Cecilia\workspace\InfiniteRecharge_2020\build
[echo] [athena-compile] Compiling src with classpath=C:\Users\Cecilia\wpilib\user\java\lib\CTRE_Phoenix.jar;C:\Users\Cecilia\wpilib\user\java\lib\WPI_CTRE_Phoenix.jar;C:\Users\Cecilia\wpilib\user\java\lib\navx_frc.jar;C:\Users\Cecilia\wpilib\java\current\lib\WPILib.jar;C:\Users\Cecilia\wpilib\java\current\lib\ntcore.jar;C:\Users\Cecilia\wpilib\java\current\lib\opencv.jar;C:\Users\Cecilia\wpilib\java\current\lib\cscore.jar;C:\Users\Cecilia\wpilib\java\current\lib\wpiutil.jar to build
[javac] Compiling 41 source files to C:\Users\Cecilia\workspace\InfiniteRecharge_2020\build
[javac] C:\Users\Cecilia\workspace\InfiniteRecharge_2020\src\systems\subsystems\DriveTrain.java:10: error: cannot access ControlMode
[javac] import com.ctre.phoenix.motorcontrol.ControlMode;
[javac] ^
[javac] bad class file: C:\Users\Cecilia\wpilib\user\java\lib\CTRE_Phoenix.jar(com/ctre/phoenix/motorcontrol/ControlMode.class)
[javac] class file has wrong version 55.0, should be 52.0
[javac] Please remove or make sure it appears in the correct subdirectory of the classpath.

BUILD FAILED
C:\Users\Cecilia\wpilib\java\current\ant\build.xml:93: Compile failed; see the compiler error output for details.

Total time: 1 second

Class version 52 is java 8. You need Java 11.

Let me try that out. Thank you.

Now I get this

Buildfile: C:\Users\Cecilia\workspace\InfiniteRecharge_2020\build.xml
Trying to override old definition of task classloader

BUILD FAILED
C:\Users\Cecilia\workspace\InfiniteRecharge_2020\build.xml:28: The following error occurred while executing this line:
C:\Users\Cecilia\wpilib\java\current\ant\build.xml:14: No Handler found for ClassLoader jdk.internal.loader.ClassLoaders$AppClassLoader and action org.apache.tools.ant.taskdefs.classloader.ClassLoaderAdapterAction@c88a337

Total time: 649 milliseconds

Why are you building with ant? The standard build uses gradle.

see listen here. you make a VERY good point. I will change that. once i find out how. I have been learning this stuff on my own and it has been… fun or something like that.

I recommend you start here: https://docs.wpilib.org/en/latest/docs/getting-started/getting-started-frc-control-system/wpilib-setup.html

And then create an example robot project from within VSCode as described here: https://docs.wpilib.org/en/latest/docs/getting-started/running-a-benchtop/creating-benchtop-test-program-cpp-java.html

1 Like

We generally use eclipse. is there an easy way to change the project?

Once the project is created in VSCode, you may be able to open it in Eclipse using Eclipse’s gradle plugin. There may be some custom things you need to do to make that work, however; if you’re just getting started, I recommend you stick with VSCode at least for the short term, and then figure out how to get Eclipse to work with the created project. These days you’ll find very few teams using Eclipse.

Interesting. I expected eclipse to be the common IDE for this stuff. Weird but ok! I was just taking previous years code so the projects were already completely set up with all the necessary libraries.

1 Like

The standard IDE for Java and C++ switched from Eclipse to Visual Studio Code starting in the 2019 season, and the underlying build system switched from Ant to Gradle at the same time. An official plugin for Visual Studio Code is provided to help with various commands like deploying to the robot, but fundamentally all the commands can be run at the command line. A number of teams use alternative IDEs like IntelliJ with their own plugins there, but that’s unofficial.

Looking back at our old projects, it doesnt look like we ever used gradle because I dont see the build.gradle file.

Oh interesting that makes sense then. These projects im looking at are from 2017-2018.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.