Compilation of Java actions failed

0
Hi, I am doing a application referring to Udemy site for building an ecommerce app (advance level). I am currently doing Grand Total part(Section-6 last). The following error shows up when trying to run the application.   Buildfile: F:\work\mendix\applications\ecommerce-app-main\deployment\build_core.xml compile:     [javac] Compiling 1 source file to F:\work\mendix\applications\ecommerce-app-main\deployment\run\bin     [javac] F:\work\mendix\applications\ecommerce-app-main\javasource\system\UserActionsRegistrar.java:10: error: cannot access GetHeaderInformationFromExcelFile     [javac]     registrator.registerUserAction(excelimporter.actions.GetHeaderInformationFromExcelFile.class);     [javac]                                                         ^     [javac]   bad class file: F:\work\mendix\applications\ecommerce-app-main\deployment\run\bin\excelimporter\actions\GetHeaderInformationFromExcelFile.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] F:\work\mendix\applications\ecommerce-app-main\javasource\system\UserActionsRegistrar.java:11: error: cannot access RefreshClass     [javac]     registrator.registerUserAction(excelimporter.actions.RefreshClass.class);     [javac]                                                         ^     [javac]   bad class file: F:\work\mendix\applications\ecommerce-app-main\deployment\run\bin\excelimporter\actions\RefreshClass.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] F:\work\mendix\applications\ecommerce-app-main\javasource\system\UserActionsRegistrar.java:12: error: cannot access StartImportByTemplate     [javac]     registrator.registerUserAction(excelimporter.actions.StartImportByTemplate.class);     [javac]                                                         ^     [javac]   bad class file: F:\work\mendix\applications\ecommerce-app-main\deployment\run\bin\excelimporter\actions\StartImportByTemplate.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] F:\work\mendix\applications\ecommerce-app-main\javasource\system\UserActionsRegistrar.java:13: error: cannot access ReplaceToken     [javac]     registrator.registerUserAction(mxmodelreflection.actions.ReplaceToken.class);     [javac]                                                             ^     [javac]   bad class file: F:\work\mendix\applications\ecommerce-app-main\deployment\run\bin\mxmodelreflection\actions\ReplaceToken.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] F:\work\mendix\applications\ecommerce-app-main\javasource\system\UserActionsRegistrar.java:14: error: cannot access SyncObjects     [javac]     registrator.registerUserAction(mxmodelreflection.actions.SyncObjects.class);     [javac]                                                             ^     [javac]   bad class file: F:\work\mendix\applications\ecommerce-app-main\deployment\run\bin\mxmodelreflection\actions\SyncObjects.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] F:\work\mendix\applications\ecommerce-app-main\javasource\system\UserActionsRegistrar.java:15: error: cannot access TestThePattern     [javac]     registrator.registerUserAction(mxmodelreflection.actions.TestThePattern.class);     [javac]                                                             ^     [javac]   bad class file: F:\work\mendix\applications\ecommerce-app-main\deployment\run\bin\mxmodelreflection\actions\TestThePattern.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] F:\work\mendix\applications\ecommerce-app-main\javasource\system\UserActionsRegistrar.java:16: error: cannot access ValidateTokensInMessage     [javac]     registrator.registerUserAction(mxmodelreflection.actions.ValidateTokensInMessage.class);     [javac]                                                             ^     [javac]   bad class file: F:\work\mendix\applications\ecommerce-app-main\deployment\run\bin\mxmodelreflection\actions\ValidateTokensInMessage.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] F:\work\mendix\applications\ecommerce-app-main\javasource\system\UserActionsRegistrar.java:17: error: cannot access VerifyPassword     [javac]     registrator.registerUserAction(system.actions.VerifyPassword.class);     [javac]                                                  ^     [javac]   bad class file: F:\work\mendix\applications\ecommerce-app-main\deployment\run\bin\system\actions\VerifyPassword.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] Note: F:\work\mendix\applications\ecommerce-app-main\javasource\system\UserActionsRegistrar.java uses or overrides a deprecated API.     [javac] Note: Recompile with -Xlint:deprecation for details.     [javac] 8 errors BUILD FAILED F:\work\mendix\applications\ecommerce-app-main\deployment\build_core.xml:29: Compile failed; see the compiler error output for details. Total time: 1 second    
asked
3 answers
1

It looks like you’ve opened your project in a Java IDE like Eclipse that tries to automatically compile the code for you. You probably have a higher version of Java installed there than Mendix expects. Mendix currently uses Java 11.

The solution would be to close your IDE, clean the deployment directory in Mendix Studio Pro, and rebuild the application. Studio Pro should recompile the Java files with the correct version and it should work.

Good luck!

answered
0

Hi Arpita,

Can you check the JDK directory under Edit > Preferences and report back your finding? Should look like this:

answered
0

Please have a look at the userlibs folder in your project’s root directory and remove outdated jar files. Keep the ones with the highest version number, clean your deployment directory and try again. This usually helps when I have Java compilation errors.

answered