Custom jar library cannot be accessed.

0
Oy there lads and lasses! I have built a simple java action, which only returned string – this worked fine. Then, I have moved the method generating string to a jar library, added it to a classpath, moved it to userlib folder and after some struggle managed to get it imported into the TestJavaAction, which can be seen on image below: Having this code, running project locally on Mendix, app ends up with an compilation of java actions failed – saying it cannot find the library I am using in my action:   Buildfile: C:\Users\meris\Documents\Mendix\OpenWeatherApi2-main\deployment\build_core.xml compile: [javac] Compiling 54 source files to C:\Users\meris\Documents\Mendix\OpenWeatherApi2-main\deployment\run\bin [javac] C:\Users\meris\Documents\Mendix\OpenWeatherApi2-main\javasource\myfirstmodule\actions\TestJavaAction.java:14: error: cannot access WeatherApiHelper [javac] import com.internetofmine.weatherapihelper.WeatherApiHelper; [javac] ^ [javac] bad class file: C:\Users\meris\Documents\Mendix\OpenWeatherApi2-main\userlib\ApiLibTest.jar(/com/internetofmine/weatherapihelper/WeatherApiHelper.class) [javac] class file has wrong version 60.0, should be 55.0 [javac] Please remove or make sure it appears in the correct subdirectory of the classpath. [javac] C:\Users\meris\Documents\Mendix\OpenWeatherApi2-main\javasource\myfirstmodule\actions\TestJavaAction.java:34: error: cannot find symbol [javac] return WeatherApiHelper.getBoop(); [javac] ^ [javac] symbol: variable WeatherApiHelper [javac] location: class TestJavaAction [javac] Note: C:\Users\meris\Documents\Mendix\OpenWeatherApi2-main\javasource\system\UserActionsRegistrar.java uses or overrides a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] 2 errors BUILD FAILED C:\Users\meris\Documents\Mendix\OpenWeatherApi2-main\deployment\build_core.xml:29: Compile failed; see the compiler error output for details. Total time: 2 seconds What am I doing wrong? Is there any tutorial or guide that you guys might know, that would pull me through this? Hugs o/
asked
1 answers
4

It looks like you’ve built the jar file using Java 16, but Mendix needs to be Java 11. 

Try recompiling the jar with Java 11, it should work then.

Good luck!

answered