Compile project with Jdk 1.7

Mac OS X 10.8
IntelliJ IDEA 10.5.4

I installed jdk 1.7 from: http://jdk7.java.net/download.html It's jdk 7u6

I added 1.7 SDK to IntelliJ:

Screen Shot 2012-07-30 at 12.19.33 PM.png
Updated Compiler settings: -target 1.7
Screen Shot 2012-07-30 at 12.20.58 PM.png
Trying to rebuild the project, gives error "Unable to find package java.lang in classpath or bootclasspath"

Screen Shot 2012-07-30 at 12.22.30 PM.png

:/

2 comments
Comment actions Permalink

You might need to add the jre/lib/rt.jar file to your compiler classpath as well as the ones you have.

My Windows SDK has all these libraries:

  • jdk\jre\lib\charsets.jar
  • jdk\jre\lib\deploy.jar
  • jdk\jre\lib\javaws.jar
  • jdk\jre\lib\jce.jar
  • jdk\jre\lib\jfr.jar
  • jdk\jre\lib\jsse.jar
  • jdk\jre\lib\management-agent.jar
  • jdk\jre\lib\plugin.jar
  • jdk\jre\lib\resources.jar
  • jdk\jre\lib\rt.jar
  • jdk\jre\lib\ext\dnsns.jar
  • jdk\jre\lib\ext\localedata.jar
  • jdk\jre\lib\ext\sunec.jar
  • jdk\jre\lib\ext\sunjce_provider.jar
  • jdk\jre\lib\ext\sunmscapi.jar
  • jdk\jre\lib\ext\zipfs.jar


And it doesn't have any of the jdk\lib\*.jar files you have listed.
  (*Chris*)

0
Comment actions Permalink

Thanks, I added all the jars from the jre/lib and the compilation succeded. Thanks!

0

Please sign in to leave a comment.