Launch with Java 7 in Debian package

泪湿孤枕 提交于 2019-12-24 09:59:35

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/8562118/launch-with-java-7-in-debian-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!