gpt4 book ai didi

java - 代号一构建错误 : suggesting "use -source 7"

转载 作者:行者123 更新时间:2023-11-30 03:02:01 25 4
gpt4 key购买 nike

我正在使用 Eclipse 和 Codename One。当我构建应用程序时,出现以下错误:

-----
Buildfile: C:\P\eclipse_workspace\HelloWorld\build.xml

jar:
[echo] Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
[echo] code size and wider device support
[copy] Copying 3 files to C:\P\eclipse_workspace\HelloWorld\build\tmp
[javac] C:\P\eclipse_workspace\HelloWorld\build.xml:147: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 39 source files to C:\P\eclipse_workspace\HelloWorld\build\tmp
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] C:\P\eclipse_workspace\HelloWorld\src\com\mycompany\lectures\Starter.java:197: error: strings in switch are not supported in -source 1.5
[javac] switch(option){
[javac] ^
[javac] (use -source 7 or higher to enable strings in switch)
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 1 error
[javac] 3 warnings

BUILD FAILED
C:\P\eclipse_workspace\HelloWorld\build.xml:147: Compile failed; see the compiler error output for details.

Total time: 1 second
-----

如何在 Eclipse 中解决此问题?

谢谢!

最佳答案

确保您运行的是最新的 Java 版本 Java 8。您可以更新here ,如有必要。

打开build.xml并执行查找和替换。查找 1.5 并替换为 1.7 或 1.8(尽管您必须添加 build hint `java.version=8)。

右键单击您的项目并选择属性,从左侧 Pane 导航至源代码,然后将源代码/二进制格式更改为JDK 7JDK 8(取决于您想要的版本)。

切换到下的,并将您的 Java 平台更改为最新版本

关于java - 代号一构建错误 : suggesting "use -source 7",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35730537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com