操作系统:Ubuntu 18.04.4 LTS
java -version
给出:
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)
我想运行一个程序,它需要 rxtx-2.2pre2 版本(早期的 librxtx-java 版本),所以我下载了rxtx 2.2pre2(预发布)从http://rxtx.qbang.org/wiki/index.php/下载并将其下载到我的下载文件夹中,然后将其解压并按照http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux但是当我使用该命令时sudo sh ./configure
,它会在某些时候给我错误:
./configure: line 21838: /usr/java/jre1.8.0_241/bin/javac: No such file or directory /usr/java/jre1.8.0_241 configure: WARNING: using JAVA_HOME environmental variable adjusted java.home is /usr/java/jre1.8.0_241 checking os.name Error: Could not find or load main class conftest
checking os.arch Error: Could not find or load main class conftest
checking java.vendor Error: Could not find or load main class conftest
checking java.version Error: Could not find or load main class conftest
checking os.version 5.3.0-42-generic ./configure: line 21808: cd: /usr/java/jre1.8.0_241/include: No such file or directory ./configure: line 21809: cd: /usr/java/jre1.8.0_241/include: No such file or directory
WARNING: configure is having a hard time determining which directory contains the file jni_md.h. Edit Makefile and fix the variable JAVANATINC to point to the correct directory.
The following options are available: find: '/usr/java/jre1.8.0_241/include': No such file or directory
If there are more than one option available the first was selected.
configure: creating ./config.status config.status: creating Makefile config.status: creating config.h config.status: executing depfiles commands
soldy@soldy:~/Downloads/rxtx-2.2pre2$
它显示 /usr/java/jre1.8.0_241/bin/javac:没有这样的文件或目录。事实上,这个目录中没有名为“javac”的文件。这个目录中的文件是:
ControlPanel javaws jjs orbd policytool rmiregistry tnameserv
java jcontrol keytool pack200 rmid servertool unpack200
我是否应该更改代码来查找其中确实存在的文件之一?如果是的话,哪一个?
答案1
您不需要从源代码编译此包,它被打包为librxtx-java
带版本2.2pre2。
只需使用以下命令安装:
sudo apt-get install librxtx-java
如果您确实需要编译它 - 使用以下命令安装必要的构建工具:
sudo apt-get install build-essential default-jdk
software-properties-gtk # to enable Source code
sudo apt-get build-dep librxtx-java
然后继续。
答案2
我从以下网址下载了 rxtx 2.1-7r2(稳定版)http://rxtx.qbang.org/wiki/index.php/下载,按照下载文件中的说明,我还需要在环境变量中添加 java:https://stackoverflow.com/questions/35649140/make-bin-javac-command-not-found,请按照此处的说明操作:http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux并且这个错误解决了...