在Debian软件包中使用Java 7启动 [英] Launch with Java 7 in Debian package

查看:153
本文介绍了在Debian软件包中使用Java 7启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我的应用程序创建了一个依赖于openjdk-7-jre的Debian软件包,问题是我还需要确保它使用Java 7启动(有可能是Java 6仍然是默认的。)目前我有

  Exec = java -jar Application.jar 

...这显然是默认的Java安装。我可以指定如下:

  Exec = / usr / lib / jvm / java-1.7.0-openjdk-i386 / bin / java -jar Application.jar 

...但是我有点疲惫,因为架构i386)位在那里,如果这样改变,那么可能路径将不起作用。



任何想法?还是我试图以错误的方式完成这个?或者上面的方法是否可以工作?



我无法检查Java代码本身,因为显然它不会运行,如果它是错误的版本,所以不能检查任何东西!

解决方案

您可以尝试解析

  / usr / bin / update-alternatives --query java 

在一个postinst钩子并相应地重写你的桌面文件。仍然脏,但稍好一些。


I've created a Debian package for my application that depends on openjdk-7-jre, problem is I also need to ensure it's launched with Java 7 (chances are Java 6 is still the default.) At present I have

Exec=java -jar Application.jar

...which will obviously just take the default Java install. I could specify something like:

Exec=/usr/lib/jvm/java-1.7.0-openjdk-i386/bin/java -jar Application.jar

...but I'm a bit weary because the architecture (i386) bit is in there, and if that changes then presumably the path wouldn't work.

Any ideas? Or am I trying to accomplish this the wrong way? Or will the above approach work after all?

I can't check in the Java code itself since obviously it won't run if it's the wrong version so can't check anything!

解决方案

You could try to parse the output of

/usr/bin/update-alternatives --query java

in a postinst hook and rewrite your desktop file accordingly. Still dirty, but slightly better.

这篇关于在Debian软件包中使用Java 7启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆