1. 程式人生 > >解決 匯入他人做的專案後出現Multiple annotations found at this line 的問題

解決 匯入他人做的專案後出現Multiple annotations found at this line 的問題

如題,會出現Multiple annotations found at this line:
- java.io.IOException cannot be resolved to a type
- String cannot be resolved to a type
- java.io.IOException cannot be resolved to a type
- No exception of type ServletException can be thrown; an exception type must be a 
subclass of Throwable
- The method getContextPath() from the type HttpServletRequest refers to the missing 
type String

甚至String cannot be resolved to a type這樣的各種錯誤,但專案在原機器上是正常執行的。

解決辦法兩個:

一:jdk不匹配。對方的jdk版本跟你的不同,甚至是1.6和1.7之間的差別,則必然出現這樣的錯誤。改成你自己的jdk就好。對專案右鍵properties->java build path之後就能找到了。

二:若不是這個問題,那試試project-clean。再不成功就很可能是程式碼問題或其他了。。