Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/389.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Ubuntu中使用javac编译时出错_Java_Ubuntu_Compilation_Javac - Fatal编程技术网

在Ubuntu中使用javac编译时出错

在Ubuntu中使用javac编译时出错,java,ubuntu,compilation,javac,Java,Ubuntu,Compilation,Javac,我正试图在Ubuntu中编译一些软件来运行它。我下载了它,看到有一个compile.bat文件。我试着用葡萄酒来运行它,但我遇到了一些错误。之后,我使用与compile.bat文件相同的命令创建了compile.sh文件。这些命令是: javac -extdirs lib/ core/*.java javac -extdirs lib/ movement/*.java javac -extdirs lib/ report/*.java javac -extdirs lib/ routing/*.

我正试图在Ubuntu中编译一些软件来运行它。我下载了它,看到有一个compile.bat文件。我试着用葡萄酒来运行它,但我遇到了一些错误。之后,我使用与compile.bat文件相同的命令创建了compile.sh文件。这些命令是:

javac -extdirs lib/ core/*.java
javac -extdirs lib/ movement/*.java
javac -extdirs lib/ report/*.java
javac -extdirs lib/ routing/*.java
javac -extdirs lib/ gui/*.java
javac -extdirs lib/ input/*.java
javac -extdirs lib/ applications/*.java
javac -extdirs lib/ interfaces/*.java
我试图运行.sh脚本,但出现以下错误:

root@vbox:/media/sf_shared/one_1.4.1# ./compile.sh 
error: option -extdirs not allowed with target 11
error: option -extdirs not allowed with target 11
error: option -extdirs not allowed with target 11
error: option -extdirs not allowed with target 11
error: option -extdirs not allowed with target 11
error: option -extdirs not allowed with target 11
error: option -extdirs not allowed with target 11
error: option -extdirs not allowed with target 11
以下是我的java版本:

javac 11.0.4
/usr/bin/javac
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)
/usr/bin/java
似乎“extdirs”选项不存在。但是,它被列为javac选项:

-extdirs <dirs>              Override location of installed extensions

root@vbox:/media/sf_shared/one_1.4.1# javac -extdirs
error: -extdirs requires an argument
Usage: javac <options> <source files>
use --help for a list of possible options
-extdirs覆盖已安装扩展的位置
root@vbox:/media/sf_shared/one_1.4.1#javac-extdirs
错误:-extdirs需要一个参数
用法:javac
使用--help获取可能选项的列表

我怎样才能解决它?任何帮助都是有用的,因为我对Java了解不多。

更改为java1.8可以解决@seconf所说的问题。

检查
extdirs
只能在为JDK 9之前的版本编译时使用。。谢谢你知道JDK11中ExtDir的一些解决方法吗?我自己还没有尝试过,但也许有人建议
-cp
可以帮助你…好的,谢谢。我将默认的java更改为1.8,它成功了。我也会尝试你的解决方案。