Rendre fichier jar executable ?

Résolu/Fermé
Noobinformatic Messages postés 227 Date d'inscription lundi 15 février 2016 Statut Membre Dernière intervention 17 juin 2018 - Modifié par Noobinformatic le 11/05/2016 à 17:19
zipe31 Messages postés 36402 Date d'inscription dimanche 7 novembre 2010 Statut Contributeur Dernière intervention 27 janvier 2021 - 17 mai 2016 à 22:12
Bonjour,
Je voudrais savoir comment rendre un fichier .jar executable sous linux svp car quand je le lance cela affiche :
"The file '/home/patrick/Bureau/Launcher Ascentia 3.3.jar' is not marked as executable. If this was downloaded or copied from an untrusted source, it may be dangerous to run. For more details, read about the executable bit."
Noobinformatic.


A voir également:

4 réponses

Utilisateur anonyme
11 mai 2016 à 20:37
java -jar tonfichier.jar
3
Flachy Joe Messages postés 2103 Date d'inscription jeudi 16 septembre 2004 Statut Membre Dernière intervention 21 novembre 2023 259
11 mai 2016 à 21:14
Salut,
Si tu donne le droit d’exécution au fichier, tu pourras ensuite le lancer avec un double-clic :
man chmod
chmod u+x mon-fichier.jar

0
zipe31 Messages postés 36402 Date d'inscription dimanche 7 novembre 2010 Statut Contributeur Dernière intervention 27 janvier 2021 6 407
13 mai 2016 à 18:09
Salut,

Désolé de t'avoir moinsoyer, mais là pour le coup t'étais complètement à côté de la plaque.

La bonne réponse a été donné par Rocailleux en #1.

Tiens télécharge cgoban.jar et appliques ta méthode et tu verras ;-)
0
Flachy Joe Messages postés 2103 Date d'inscription jeudi 16 septembre 2004 Statut Membre Dernière intervention 21 novembre 2023 259
16 mai 2016 à 20:37
Salut zipe31,
ça marche très bien chez moi mais ce n'est peut être pas le cas sur toutes les distrib...
Donc pour préciser :
Une fois le bit exec coché ça ce lance au double clic au moins sous XFCE 4.x
et en ligne commande avec
$ ./mon-fichier.jar
au moins avec bash 4.x
0
UnGnU Messages postés 1158 Date d'inscription lundi 2 mai 2016 Statut Contributeur Dernière intervention 22 décembre 2020 157 > Flachy Joe Messages postés 2103 Date d'inscription jeudi 16 septembre 2004 Statut Membre Dernière intervention 21 novembre 2023
17 mai 2016 à 12:50
Salut,

Ça doit dépendre de l'environnement alors, parce que chez moi ça ne marche pas ;-\

$ inxi -S
System: Host: debian Kernel: 3.16.0-4-586 i686 (32 bit) Desktop: Gnome 3.14.4 Distro: Debian GNU/Linux 8

$ file cgoban.jar
cgoban.jar: Zip archive data, at least v2.0 to extract

$ ls -l cgoban.jar
-rwxr-xr-x 1 debian debian 1526480 mai 17 12:38 cgoban.jar

$ ./cgoban.jar
bash: ./cgoban.jar: cannot execute binary file: Erreur de format pour exec()


Et idem en graphique, ça ne m'ouvre que l'archive ;-(
0
Utilisateur anonyme
17 mai 2016 à 13:10
en ligne commande avec
$ ./mon-fichier.jar
au moins avec bash 4.x


Sûrement une pitrerie venant d'ubuntu ( une conf spéciale dans le .bashrc ?) , marche pas chez moi avec bash v4.3

$bash --version
GNU bash, version 4.3.42(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
Licence GPLv3+ : GNU GPL version 3 ou ultérieure <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

rocail:~/test/java $java -jar fichier.jar
Hellow world

rocail:~/test/java $ls -l fichier.jar
-rwxr-xr-x 1 rocail rocail 753 17 mai 13:02 fichier.jar

rocail:~/test/java $./fichier.jar
bash: ./fichier.jar: cannot execute binary file: Erreur de format pour exec()
0
zipe31 Messages postés 36402 Date d'inscription dimanche 7 novembre 2010 Statut Contributeur Dernière intervention 27 janvier 2021 6 407 > Flachy Joe Messages postés 2103 Date d'inscription jeudi 16 septembre 2004 Statut Membre Dernière intervention 21 novembre 2023
17 mai 2016 à 18:34
Je confirme que ça ne marche pas non plus chez moi :

$ wget -q http://files.gokgs.com/javaBin/cgoban.jar

$ file cgoban.jar
cgoban.jar: Zip archive data, at least v2.0 to extract

$ ls -lh
total 1,5M
-rw-r--r-- 1 jp jp 1,5M mai 17 18:26 cgoban.jar

$ chmod u+x cgoban.jar

$ ls -lh
total 1,5M
-rwxr--r-- 1 jp jp 1,5M mai 17 18:26 cgoban.jar

$ ./cgoban.jar
invalid file (bad magic number): Exec format error

$ inxi -S
System: Host: Mint-Qiana
Kernel: 3.19.0-32-generic x86_64 (64 bit)
Desktop: MATE 1.12.0
Distro: Linux Mint 17.3 Rosa

$ bash --version
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
0
bibou55 Messages postés 69 Date d'inscription jeudi 4 septembre 2014 Statut Membre Dernière intervention 7 octobre 2017 6
12 mai 2016 à 20:01
méthode graphique :
Clic droit sur le fichier --> propriétés --> permissions ---> coche "autoriser l'execution du fichier comme un programme".
Voila ^^
0
Noobinformatic Messages postés 227 Date d'inscription lundi 15 février 2016 Statut Membre Dernière intervention 17 juin 2018 6
13 mai 2016 à 17:18
Merci
0