I have a working Java Project (literally just 2 JAVA files) that need to be built in either Maven or Gradle. Since I wrote my Java Project in Eclipse IDE for Java Delopers (Kepler Service Release 2
, 20140224-0627
), I found this article to add Maven to my Java Project.
After adding Maven to my project, I had to follow this SO answer to allow myself to Right Click the Project -> Maven
-> Update Project...
properly. If I Right Click the Project -> Run As
-> Maven Clean
, I get a BUILD SUCCESS
(thanks to this SO answer). But now when I Right Click the Project -> Run As
-> Maven Install
, I get the following:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building AMC 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ RobTillmanProject ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Users\names\workspace\paging-mission-control\AMC\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ RobTillmanProject ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 2 source files to D:\Users\names\workspace\paging-mission-control\AMC\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.050s
[INFO] Finished at: Tue Feb 07 16:35:15 EST 2023
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project RobTillmanProject: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
As per the error, it looks like I need to add a JDK to the Installed JREs
list (just as this SO answer suggests).
In Eclipse IDE, Windows
-> Preferences
-> Java
-> Installed JREs
, I have jre1.8.0_333 (default)
installed. On my PC, in my C:\Program Files\Java
folder, I've installed jdk-17
, jdk-17.0.6
and jdk-19.0.2
. However, when I go to add any one of the JDKs (I've tried JRE Type Standard 1.1x VM
and Standard VM
), I get the error message Target is not a JDK root. System library was not found.
I'm running Eclipse IDE on Windows 10.
Any suggestions?