使用IDEA创建的java项目,在使用如下代码时IDEA提示Multi-catches are not supported at this language level:

try {......
} catch (ClassNotFoundException | NoSuchMethodException e) {e.printStackTrace();
}

原因:
IDEA Maven项目默认的编译器bytecode是1.5,此版本编译器是java5,而Multi-catches是在java7才开始支持的,所以IDEA提示不支持。官方宣布的原因:

Apache Maven Compiler PluginThe Compiler Plugin is used to compile the sources of your project. Since 3.0, the default compiler is javax.tools.JavaCompiler (if you are using java 1.6) and is used to compile Java sources. If you want to force the plugin using javac, you must configure the plugin option forceJavacCompilerUse.Also note that at present the default source setting is 1.5 and the default target setting is 1.5, independently of the JDK you run Maven with. If you want to change these defaults, you should set source and target as described in Setting the -source and -target of the Java Compiler. See http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html.

解决方式:
一、在pom.xml中增加

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.3.2</version><configuration><source>1.8</source><target>1.8</target></configuration>
</plugin>

二、修改IDEA配置,默认就使用1.8版本
点击File -> Settings -> Build,Execution,Deployment -> Compiler -> Java Compiler
Project bytecode version下拉框选择1.8。
该选项不会生效,因maven项目并没有使用此处指定的编译器。

IDEA提示Multi-catches are not supported at this language level的解决办法相关推荐

  1. SpringCloud工作笔记031---Idea中JDK为1.8,还提示Diamond types are not supported at this language level

    JAVA技术交流QQ群:170933152 project的java level 已经核实确实为8,但是IDEA里面仍然会有如下图的提示: 通过查看项目设置,发现project的java level  ...

  2. diamond types are not supported at this language level

    在intellij导入git项目之后出现 diamond types are not supported at this language level错误 或者String等报错 File->P ...

  3. lambda expressions are not supported at this language level

    IDEA下报错:lambda expressions are not supported at this language level 解决: 1. File -> Project Struct ...

  4. 中标麒麟操作系统,yum安装软件时提示:“已加载插件:langpacks,无须任何处理“的解决办法

    中标麒麟操作系统,yum安装软件时提示:"已加载插件:langpacks,无须任何处理"的解决办法 通常都是由于yum仓库未包含你所要安装的那款软件造成. 解决办法: 输入如下命令 ...

  5. 关于错误提示:could not find a part of path “X:\”的解决办法

    Win2k在NTFS系统下可能会出现这样的错误提示,解决办法很简单,只要在网站所在系统盘根目录给ASPNET用户读取权限就可以了,因为原因就是 Server.MapPath() 这个方法,这个方法是让 ...

  6. 【2020可用】Python使用 imaplib imapclient连接网易邮箱提示 Unsafe Login. Please contact kefu@188.com for help 的解决办法

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:http://blog.csdn.net/jony_online/article/d ...

  7. 计算机上安装了更新ie版本,XP系统安装不了ie提示“安装了更新的Internet Explorer版本”的原因及解决办法...

    IE是一款功能非常强大的浏览器,其具有非常强大的用户群体.不过,最近有用户在xp系统电脑上安装Internet Exployer浏览器时,遇到提示ldquo;安装程序无法继续,因为你的计算机上安装了更 ...

  8. 在客户端上登录微软邮箱时提示您输出的用户名或密码不起作用的解决办法

    有些同学可能会在用微软邮箱登录outlook或者其他邮箱客户端的时候,明明输入的是正确的用户名和密码,但是却提示"您输入的用户名或密码不起作用".其实原因很简单,这是因为你的微软账 ...

  9. word保存提示“由于文件许可错误,word无法完成保存”的解决办法

    word保存提示"由于文件许可错误,word无法完成保存" **问题:**我使用的是win10操作系统,在某次更新之后出现了word无法保存的问题,错误信息如下图 **解决办法:* ...

  10. 关于windows系统安装时提示不能装在GPT分区格式的分区上的解决办法

    本人最近在帮别人装系统的时候发现,有些电脑写着专为win8或者以上,这些电脑里边有一个UEFI启动,而且这些电脑的硬盘分区格式一般都是GPT,而本人制作的win10安装盘,在这些电脑上安装的时候出现了 ...

最新文章

  1. numpy.random.seed()
  2. Ubuntu 12.04中文输入法的安装
  3. Java 多线程(三)线程间的通信jdk1.5中Lock,Condition---生产者消费者为例
  4. 写入访问权限冲突_全面介绍 Linux 权限
  5. oracle cluster n,10g Rac的cluster_interconnect信息
  6. 简单有趣的 NLP 教程:手把手教你用 PyTorch 辨别自然语言(附代码)
  7. Fluid 给数据弹性一双隐形的翅膀 -- 自定义弹性伸缩
  8. java基础—IO流概述
  9. IOS开发中的几种设计模式
  10. 如何区分炫耀和分享?
  11. Spring的Bean有哪些作用域?
  12. cuda驱动版本显卡对应关系
  13. Vue学习之旅----vuex不同组件间数据共享-状态一致
  14. PS钢笔--制图抠图
  15. Hash校验工具、MD5 SHA1 SHA256命令行工具
  16. halcon 图像合成与通道
  17. cad图形不见了怎么办_CAD画图突然消失 怎么找回
  18. Java阿凯_彩虹城堡之七彩宝石篇最终版攻略
  19. PyTorch基础-自定义数据集和数据加载器(2)
  20. 梅尔倒频谱系数(Mel-frequency cepstrum Coefficents)

热门文章

  1. 重庆大学计算机学院毕业设计题目,图像处理毕业设计题目.docx
  2. 观大数据有感_观《大数据时代》有感
  3. 游戏密码123456问题
  4. 网站建设的方案和流程介绍
  5. 脑皮质算法(3)-- 新皮层的位置:利用皮层网格细胞的感觉运动物体识别理论
  6. python开发的军棋自动裁判软件
  7. 【比赛回顾】广工大2020级年ACM第一次月赛——Dio的面包工坊
  8. 第一次用HTML设计表格,以及使用百度脑图的感受
  9. PHPStorm+Xdebug配置(phpStudy)
  10. 0 win10重装partition_win10换win7,U盘装机错误,Error:partition 0 ended too near怎么回事?怎么修?...