You are not logged in.

#1 2014-04-09 22:22:37

Marcel-
Member
From: Utrecht, NL
Registered: 2006-12-03
Posts: 266

[DONE] Suggested addition to Java Package Guidelines

In the Java Package Guidelines there are shell scripts that run the java jar or class file. Shouldn't the $@ be added as a parameter, to feed parameters to the java application?

For instance, I wrote the following for Logisim:

#!/bin/sh
"$JAVA_HOME/bin/java" -jar '/usr/share/java/logisim/logisim.jar' $@

Last edited by Marcel- (2014-04-11 10:32:43)

Offline

#2 2014-04-09 22:45:26

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: [DONE] Suggested addition to Java Package Guidelines

It should be quoted to prevent word expansion of the individual arguments, i.e.

"$@"

It makes sense to me to include this in the guidelines so +1.

Incidentally, I'm not sure what the current policy on hashbangs is (#!/usr/bin/sh?, indifference?).


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2014-04-09 23:10:36

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: [DONE] Suggested addition to Java Package Guidelines

If you change that, I suggest to add an "exec", too. We don't need a useless shell in the background, right?

#!/bin/sh
exec "$JAVA_HOME/bin/java" -jar '/usr/share/java/logisim/logisim.jar' $@

Incidentally, I'm not sure what the current policy on hashbangs is (#!/usr/bin/sh?, indifference?).

I believe "/bin/sh" is required by POSIX and must provide a POSIX compliant shell, so /bin/sh is the portable hashbang. If you want bash, usr /usr/bin/bash I guess.

Last edited by progandy (2014-04-09 23:14:10)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2014-04-10 13:54:33

Marcel-
Member
From: Utrecht, NL
Registered: 2006-12-03
Posts: 266

Re: [DONE] Suggested addition to Java Package Guidelines

So, the proposed changes should be resp.

#!/bin/sh
exec "$JAVA_HOME/bin/java" -jar '/usr/share/java/PROGRAMNAME/PROGRAMNAME.jar' "$@"

and

#!/bin/sh
exec "$JAVA_HOME/bin/java" '/usr/share/java/PROGRAMNAME/PROGRAMCLASSNAME' "$@"

I can edit the wiki page myself, but I think it's good that someone else also agrees with this change.

Offline

#5 2014-04-10 22:08:50

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: [DONE] Suggested addition to Java Package Guidelines

I agree, for whatever it's worth.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#6 2014-04-11 10:33:10

Marcel-
Member
From: Utrecht, NL
Registered: 2006-12-03
Posts: 266

Re: [DONE] Suggested addition to Java Package Guidelines

Ok, done!

Offline

Board footer

Powered by FluxBB