[英]How to build java project with command-line arguments in IntelliJ
I have a java test project which has two binary fields.when I want to compile the project in IntelliJ,it complains that I should use -source 7 instead of -source 1.6 while compiling.my JDK is the latest.I don't know how to fix this. 我有一个java测试项目,它有两个二进制字段。当我想在IntelliJ中编译项目时,它抱怨我应该在编译时使用-source 7而不是-source 1.6.my JDK是最新的。我不知道如何解决这个问题。
sample code: 示例代码:
public class BitWiseTest {
static int val1 = 0b01110;//compile-time error
static int val2 = 0b11011;//compile-time error
public static void main()
{
System.out.println(val1 & val2);
}
}
The issue mainly happens due to incorrect configuration of Project language level set. 问题主要是由于Project语言级别设置的错误配置。 Thus although you may be using java 7 but since the project language level is configured incorrectly it uses constructs only valid in that language level.Thus you get the error.
因此,尽管您可能正在使用java 7,但由于项目语言级别配置不正确,因此它使用的构造仅在该语言级别有效。因此您会收到错误。 To fix it follow the steps :
要修复它,请按以下步骤操作:
Go to File->Project Structure->Project & Change the project language level to 7.0 & project SDK to 1.7 转到文件 - >项目结构 - >项目并将项目语言级别更改为7.0并将项目SDK更改为1.7
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.