简体   繁体   中英

Eclipse doesn't recognize java api

I just got a new mac, and I copied my projects from eclipse on my old pc to it, but it isn't recognizing any functions or types build into java. It won't let me inport java either to fix it. Every time I made a variable of a type built into java, it gives me the error "variable cannot be resolved to a type" and whenever I make the constructor for a class, it give me ther error "Implicit super constructor Object() is undefined. Must explicitly invoke another constructor"

Is there some extra configuration I have to do, or can you just not move projects from one os to another?

This type of problem happens when Eclipse is having trouble accessing your JRE classes to compile against. Look in your preferences under Java -> Installed JREs and make sure that the specified JREs are legit. Select the listings and hit edit. Then make sure that there is stuff listed under JRE system libraries.

This problem seems to happen more often with Macs since JRE layouts on Mac is different than any other platform.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM