Java使用中的常见的一些问题

版权声明:转载请注明出处 https://blog.csdn.net/weixin_41879093/article/details/83247082

问题

出现“Access restriction: The type ‘JPanel’ is not API (restriction on required library ‘D:\Program Files\Java\jre1.8.0_172\lib\rt.jar’)”时
1.先删除Libraries

Project Properties -> Build Path -> Libraries -> Remov

e
2.然后再添加回来就行了

Add Library -> JRE System Library

问题

出现“Unhandled exception type FileNotFoundException”等有Exception问题时
1.只需要用以下代码就行了

try{
}
catch(Exception e){
}

问题

出现“BufferedImage cannot be resolved to a type”
1.只需要更改一个设置就行了

Windows -> Preferences -> Java -> Compiler -> Errors/Warnings ->
Deprecated and restricted API -> Forbidden reference (access rules):
-> change to warning

猜你喜欢

转载自blog.csdn.net/weixin_41879093/article/details/83247082