I’m working on a simulation program separate from WPILib stuff. However, it will sometimes be beneficial to utilize the simulateJava feature of a 2019 WPI project.
When running ./gradlew wpi:simulateJava
(my wpi project is in a submodule), it looks like it is successful:
Program Output logfile: /home/josh/Programming/First1444/Simulation/robot2019-sim/wpi/build/stdout/simulateJava.log
Simulation Launched! PID: 23425 (written to /home/josh/Programming/First1444/Simulation/robot2019-sim/wpi/build/pids/simulateJava.pid)
However, if I dig deeper, the PID isn’t running. When running wpi/build/gradlerio_simulateJava.sh I get this error:
Error: Unable to initialize main class com.first1444.frc.robot2019.Main
Caused by: java.lang.NoClassDefFoundError: com/first1444/sim/api/RunnableCreator
Now at first I thought. Hmm, probably just a simple problem with my jar configuration. But that’s not the case. Here’s a simple layout of how my project is structured:
robo-sim
- submodule: “api”
- submodule: “wpi”
- Depends on “api”
robo2019-sim
- submodule: “core”
- Depends on robo-sim:api
- submodule: “wpi” (This is the submodule which I’m running simulateJava from)
- Depends on “core”
- Depends on robo-sim:wpi
So the problem is that everything from robo-sim:api (such as RunnableCreator
) fails to be put into the classpath of the jar but classes in robo-sim:wpi are in correctly and of course classes from “core” work correctly.
This could be a problem in my robo-sim library, but I managed to create a fat jar in a libgdx program that had dependencies correct.
I’m pretty lost here. I know that my gradle configuration is probably one of the most uncommon ones that involves WPILib but any help is appreciated.
I don’t think this problem is kotlin related. I’m using a mix of Java and Kotlin.
robo-sim: https://github.com/frc1444/robo-sim
robo2019-sim: https://github.com/frc1444/robot2019-sim
I will be creating a thread before kickoff about this simulation. It’s coming along well but messing with gradle for an entire day is not fun.
I’m running Ubuntu 19.04 and I’m using Java 12. I could try switching to Java 11, but I’m able to run simulateJava without errors on other traditional robot programs.