25

From someone's project, I am getting this error:

Java Build Path Problems (1 item)
Build path specifies execution environment J2SE-1.5.  There are no JREs installed in the workplace that are strictly compatible with this environment.  

I have the latest JDK (jdk1.6.0_25). From my understanding, I can do one of the following:

  1. Download the J2SE-1.5 environment to match the project.
  2. Edit the project to agree with the latest JDK. How can I do this?
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
O_O
  • 4,397
  • 18
  • 54
  • 69
  • Download the J2SE-1.5 environment due to prevent situation, when you will use new classes from newer jre, which in 1.5 was absent. This is a solution. – msangel Feb 28 '13 at 22:26
  • four things are to be done, look http://stackoverflow.com/a/20692572/715269 – Gangnus Dec 19 '13 at 22:05

6 Answers6

53
  1. Right click on project, Properties, Java Build Path.
  2. Remove the current JRE library.
  3. Click Add library > JRE System Library > Workspace default JRE.
Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498
20

Here's a good discussion on this:

Basically you should

  1. Download and install the 1.5 JDK. (download link)
  2. In Eclipse, Go to WindowPreferencesJavaInstalled JREs.
  3. Add the 1.5 JDK to the list.
  4. Select 1.5 as Compiler Compliance Level.
Community
  • 1
  • 1
aioobe
  • 413,195
  • 112
  • 811
  • 826
14

Go for the second option, Edit the project to agree with the latest JDK

  • Right click "JRE System Library [J2SE 1.5] in your project"
  • Choose "Properties"
  • Select "Workspace default JRE (jdk1.6)

enter image description here

Prashanth Sams
  • 19,677
  • 20
  • 102
  • 125
4

From the Package Explorer in Eclipse, you can right click the project, choose Build Path, Configure Build Path to get the build path dialog. From there you can remove the JRE reference for the 1.5 JRE and 'Add Library' to add a reference to your installed JRE.

highlycaffeinated
  • 19,729
  • 9
  • 60
  • 91
3

To configure your JRE in eclipse:

  • Window > Preferences > Java > Installed JREs...
  • Click Add
  • Find the directory of your JDK > Click OK
Kyle
  • 4,202
  • 1
  • 33
  • 41
1

Try this too in addition to MahmoudS comments. Change the maven compiler source and target in your pom.xml to the java version which you are using. Say 1.7 for jdk7

<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
vsriram92
  • 593
  • 1
  • 4
  • 15