1. 程式人生 > >在eclipse的java EE模式中匯入別人的專案出現Multiple annotations found at this line

在eclipse的java EE模式中匯入別人的專案出現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。
三:以上都不能解決的時候就要考慮匯入的專案缺少某些.jar或者程式碼有錯誤。