小编Pra*_*chi的帖子

设置 JAVA_HOME 变量的问题

我已经在路径上安装了 JDK /usr/lib/jvm/java-8-oracle。要设置JAVA_HOME变量,我/etc/environment 在 gedit 中打开并添加:

JAVA_HOME="/usr/lib/jvm/java-8-oracle" 到它。

但是我在将其另存为时出错:

Could not save the file “/etc/environment”.
You do not have the permissions necessary to save the file. Please check   that you typed the location correctly and try again.
Run Code Online (Sandbox Code Playgroud)

哪里出错了?如何设置 JAVA_HOME 变量?

java jdk environment-variables

4
推荐指数
1
解决办法
7276
查看次数

if 命令语法

我的shell脚本代码如下:

echo "Enter file name";
read fname;
if [-f$fname];
then
    echo "File already exists";
fi`
Run Code Online (Sandbox Code Playgroud)

但是,当我运行脚本时,出现此错误:

[-ffile]: not found
Run Code Online (Sandbox Code Playgroud)

我试过间距,-f $fname但我仍然遇到同样的错误。为什么会发生这种情况,我该如何解决?

command-line bash syntax

3
推荐指数
1
解决办法
1104
查看次数

标签 统计

bash ×1

command-line ×1

environment-variables ×1

java ×1

jdk ×1

syntax ×1