Drools Java 7 support in Eclipse

六月ゝ 毕业季﹏ 提交于 2019-12-12 18:24:02

问题


I created a Drools project in Eclipse (Indigo) configured to use JRE 1.7. But I get an error pointing to my .drl file:

com/sample/DroolsTest$Message : Unsupported major.minor version 51.0

The com.sample.DroolsTest.Message class is imported by the .drl file. The Drools runtime was 5.2.1 (also tried with 5.3.0.Final).

Any help would be appreciated. Thanks.


回答1:


This exception doesn't seem to have to do anything with Drools in particular, but is a generic Java error. It occurs if you try to execute a Java class with a JRE that is older than the JDK that was used to compile it. For example, if you compiled the class with a JDK7 and then tried to execute it with a JDK6, you would get this error.




回答2:


Just to detail above answer and comment. I had both JRE6 and JRE7 installed, with JRE7 being the default. I had to do two things to remove the error from the drools sample project.

  1. Set the JRE for the project to 1.6 Project properties->Java Build Path->Libraries. Remove JRE System Library 1.7 and Add Library->JRE System Library->Alternate JRE->JRE6
  2. Set the compiler compliance level for the project at 1.6. Project properties->Java Compiler->check Enable Project specific settings and set Compiler compliance level at 1.6.


来源:https://stackoverflow.com/questions/10121257/drools-java-7-support-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!