[MAVEN] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

[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: 6.698 s
[INFO] Finished at: 2018-01-02T23:52:32+07:00
[INFO] Final Memory: 17M/306M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project bpmn-examples: 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

ถ้าลอง Install Package ที่มาจาก Maven แล้วมี Error Message ดังนี้ แล้ว สามารถแก้ไขโดยขั้นตอน ดังนี้ครับ สำหรับคนที่ใช้ Eclipse

  • ไปที่เมนู Window >> Preferences >> Java >> Installed JREs >> Execution Enviroment
  • เลือก jre ที่ใช่ ในที่นี้ผมเลือก  jdk 1.8.0_152  (ถ้ามีเวอร์ชันที่ใหม่ กว่าก็เลือกอันที่ใหม่ที่สุดนะครับ)
  • จากนั้นคลิกขวาที่ Project เลือก Maven >> Update Project รอสักพักครับ ^__^