在非交互式脚本中安装jre

时间:2014-03-09 06:50:18

标签: java bash jvm

我想在非交互式脚本中安装jre 1.7。 有没有办法在相同的情况下做到这一点?

update-alternatives --config java

There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
*+ 2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
   3           /usr/lib/jvm/jre1.7/bin/java

1 个答案:

答案 0 :(得分:7)

看看man update-alternatives。这写着:

   --set name path
          Set  the  program  path  as alternative for name.
          This is equivalent to --config but is non-interactive
          and thus scriptable.