Précédent   Forum des professionnels en informatique > Systèmes > Linux > Applications > Shell
Shell Vos questions sur l'utilisation des commandes shell
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 25/05/2007, 10h11   #1
Candidat au titre de Membre du Club
 
Inscription : janvier 2007
Messages : 50
Détails du profil
Informations forums :
Inscription : janvier 2007
Messages : 50
Points : 13
Points : 13
Par défaut Conversion BAT to SH

Bonjour j'ai un fichier bat que je voudrai traduire en.sh

la bat :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
echo off
 
 
 
set JAVAMAIL=lib\activation.jar;lib\mail.jar;lib\smtp.jar;lib\dsn.jar;lib\imap.jar;lib\pop3.jar;
 
set ENTREPRISE=lib\ENTREPRISE.jar;
 
set CLASSES=TestSmtp.jar
 
set MAIN_CLASSE=com.entreprise.frames.FramePrincipale
 
 
 
"C:\Program Files\Java\jre1.5.0_11\bin\java" -classpath %JAVAMAIL%%ENTREPRISE%%CLASSES% %MAIN_CLASSE%
Celui ci fonctionne

maintenant le sh

Code :
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
 
set $JAVAMAIL=lib/activation.jar;lib/mail.jar;lib/smtp.jar;lib/dsn.jar;lib/imap.jar;lib/pop3.jar;
set $entreprise=lib/entreprise.jar;
 
set $CLASSES=TestSmtp.jar
 
set $MAIN_CLASSE=com.entreprise.frames.FramePrincipale
 
 
 
$JAVA_HOME -classpath $JAVAMAIL$ENTREPRISE$CLASSES $MAIN_CLASSE
Ou ai-je faux car il me donne ca pour sh timmy.sh

Citation:
timmy.sh: line 3: lib/mail.jar: cannot execute binary file
timmy.sh: line 3: lib/smtp.jar: cannot execute binary file
timmy.sh: line 3: lib/dsn.jar: cannot execute binary file
timmy.sh: line 3: lib/imap.jar: cannot execute binary file
timmy.sh: line 3: lib/pop3.jar: cannot execute binary file
: command not found
: command not found
timmy.sh: line 8: /usr/local/jdk1.5.0_09: is a directory
Avant j'avais des erreurs de permissions sur les jars alrs j'ai mis toutes les merm a tous les utilisateurs ..


MErci
qdqdfqfdqdxcwcrzsdfw est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 10h22   #2
Membre actif
 
Avatar de Fango
 
Inscription : décembre 2005
Messages : 197
Détails du profil
Informations personnelles :
Âge : 28

Informations forums :
Inscription : décembre 2005
Messages : 197
Points : 178
Points : 178
Salut qdq! c'est pas des export plutot qu'il faut faire a la place des set?
Fango est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 10h27   #3
Candidat au titre de Membre du Club
 
Inscription : janvier 2007
Messages : 50
Détails du profil
Informations forums :
Inscription : janvier 2007
Messages : 50
Points : 13
Points : 13
J'ai essayé

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
 
#!/bin/sh
 
export JAVAMAIL=lib/activation.jar;lib/mail.jar;lib/smtp.jar;lib/dsn.jar;lib/imap.jar;lib/pop3.jar
export ENTREPRISE=lib/entreprise.jar
 
export CLASSES=TestSmtp.jar
 
export MAIN_CLASSE=com.entrerpise.frames.FramePrincipale
 
 
 
${JAVA_HOME}/bin/java -classpath ${JAVAMAIL}${ENTREPRISE}${CLASSES} ${MAIN_CLASSE}
voila l'erreur

Citation:
timmy.sh: line 3: lib/mail.jar: cannot execute binary file
timmy.sh: line 3: lib/smtp.jar: cannot execute binary file
timmy.sh: line 3: lib/dsn.jar: cannot execute binary file
timmy.sh: line 3: lib/imap.jar: cannot execute binary file
timmy.sh: line 3: lib/pop3.jar: cannot execute binary file
: command not found
Exception in thread "main" java.lang.NoClassDefFoundError: com/entreprise/frames/Fram ePrincipale
merci de la reponse
qdqdfqfdqdxcwcrzsdfw est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 10h28   #4
Membre Expert
 
Avatar de becket
 
Frédéric Brugmans
Informaticien multitâche
Inscription : février 2005
Messages : 661
Détails du profil
Informations personnelles :
Nom : Frédéric Brugmans

Informations professionnelles :
Activité : Informaticien multitâche

Informations forums :
Inscription : février 2005
Messages : 661
Points : 1 196
Points : 1 196
export VARIABLE et pas export $VARIABLE dans ce cas
becket est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 10h32   #5
Candidat au titre de Membre du Club
 
Inscription : janvier 2007
Messages : 50
Détails du profil
Informations forums :
Inscription : janvier 2007
Messages : 50
Points : 13
Points : 13
je m'etais rendu compte de l'erreur entre temps
qdqdfqfdqdxcwcrzsdfw est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 10h33   #6
Modérateur
 
Avatar de al1_24
 
Homme Alain
Ingénieur d'études décisionnel
Inscription : mai 2002
Messages : 4 450
Détails du profil
Informations personnelles :
Nom : Homme Alain
Âge : 51
Localisation : France, Val de Marne (Île de France)

Informations professionnelles :
Activité : Ingénieur d'études décisionnel
Secteur : Conseil

Informations forums :
Inscription : mai 2002
Messages : 4 450
Points : 7 559
Points : 7 559
Dans ta conversion, tu as oublié les ; à la fin des définitions de JAVAMAIL et ONYME
__________________
Modérateur Langage SQL
Règles du forum Langage SQL à lire par tous, N'hésitez pas à consulter les cours SQL
N'oubliez pas le bouton et pensez aux balises [code]
Si une réponse vous a aidé à résoudre votre problème, n'oubliez pas de voter pour elle en cliquant sur
al1_24 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 10h35   #7
Candidat au titre de Membre du Club
 
Inscription : janvier 2007
Messages : 50
Détails du profil
Informations forums :
Inscription : janvier 2007
Messages : 50
Points : 13
Points : 13
avec les ;

Citation:
timmy.sh: line 3: lib/mail.jar: cannot execute binary file
timmy.sh: line 3: lib/smtp.jar: cannot execute binary file
timmy.sh: line 3: lib/dsn.jar: cannot execute binary file
timmy.sh: line 3: lib/imap.jar: cannot execute binary file
timmy.sh: line 3: lib/pop3.jar: cannot execute binary file
: command not found
: command not found
: command not found
: command not found
Exception in thread "main" java.lang.NoClassDefFoundError: com/entreprise/frames/FramePrincipale
qdqdfqfdqdxcwcrzsdfw est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 10h40   #8
Candidat au titre de Membre du Club
 
Inscription : janvier 2007
Messages : 50
Détails du profil
Informations forums :
Inscription : janvier 2007
Messages : 50
Points : 13
Points : 13
bon apparemment les command not found proviennent des lignes sans rien
et des points virgule dans la variable JAVAMAIL
qdqdfqfdqdxcwcrzsdfw est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 10h46   #9
Membre actif
 
Avatar de Fango
 
Inscription : décembre 2005
Messages : 197
Détails du profil
Informations personnelles :
Âge : 28

Informations forums :
Inscription : décembre 2005
Messages : 197
Points : 178
Points : 178
c'est pas des : a la place des ; ? (je ne suis pas sur)

et les command not found ne viendrait pas de ta variable JAVA_HOME ? verifie que JAVA_HOME/bin/java est correct peut etre, ou donne le chemin sans la variable pour tester.
Fango est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 11h00   #10
Candidat au titre de Membre du Club
 
Inscription : janvier 2007
Messages : 50
Détails du profil
Informations forums :
Inscription : janvier 2007
Messages : 50
Points : 13
Points : 13
bon il manquait jre entre java_home et bin, mais ca ne resoud rient
qdqdfqfdqdxcwcrzsdfw est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 11h02   #11
Membre Expert
 
Avatar de becket
 
Frédéric Brugmans
Informaticien multitâche
Inscription : février 2005
Messages : 661
Détails du profil
Informations personnelles :
Nom : Frédéric Brugmans

Informations professionnelles :
Activité : Informaticien multitâche

Informations forums :
Inscription : février 2005
Messages : 661
Points : 1 196
Points : 1 196
tu as "oublié" les "
Code :
1
2
 
 export JAVAMAIL="lib/activation.jar;lib/mail.jar;lib/smtp.jar;lib/dsn.jar;lib/imap.jar;lib/pop3.jar"
becket est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 11h07   #12
Candidat au titre de Membre du Club
 
Inscription : janvier 2007
Messages : 50
Détails du profil
Informations forums :
Inscription : janvier 2007
Messages : 50
Points : 13
Points : 13
avec le nouveau fichier

Code :
1
2
3
4
5
6
7
8
9
#!/bin/sh
export JAVAMAIL="lib/activation.jar;lib/mail.jar;lib/smtp.jar;lib/dns.jar;lib/imap.jar;lib/pop3.jar"
export ENTREPRISE=lib/entreprise.jar
 
export CLASSES=TestSmtp.jar
 
export MAIN_CLASSE=com.entreprise.frames.FramePrincipale
 
"/usr/local/jdk1.5.0_09/jre/bin/java" -classpath ${JAVAMAIL}${ENTREPRISE}${CLASSES} ${MAIN_CLASSE}
ca me dnne juste l'erreur classDefNotFound ....
qdqdfqfdqdxcwcrzsdfw est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 11h09   #13
Membre actif
 
Avatar de Fango
 
Inscription : décembre 2005
Messages : 197
Détails du profil
Informations personnelles :
Âge : 28

Informations forums :
Inscription : décembre 2005
Messages : 197
Points : 178
Points : 178
verifie alors le chemin apres -classpath
Fango est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 11h23   #14
Candidat au titre de Membre du Club
 
Inscription : janvier 2007
Messages : 50
Détails du profil
Informations forums :
Inscription : janvier 2007
Messages : 50
Points : 13
Points : 13
Nouveau fichier

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
export JAVAMAIL="lib/activation.jar;lib/mail.jar;lib/smtp.jar;lib/dns.jar;lib/imap.jar;lib/pop3.jar"
export ENTREPRISE=lib/entreprise.jar
 
export CLASSES=TestSmtp.jar
 
export MAIN_CLASSE=com.entreprise.frames.FramePrincipale
 
"/usr/local/jdk1.5.0_09/jre/bin/java" -classpath ${JAVAMAIL}${ENTREPRISE}${CLASSES} ${MAIN_CLASSE}
echo "JAVAMAIL :" ${JAVAMAIL}
echo "ENTREPRISE :"${ENTREPRISE}
echo "CLASSES :"${CLASSES}
echo "MAIN_CLASSE :"${MAIN_CLASSE}
echo "tout :" ${JAVAMAIL}${ENTREPRISE}${CLASSES} ${MAIN_CLASSE}

ce qu'il met met
Citation:
Exception in thread "main" java.lang.NoClassDefFoundError: com/entreprise/frames/FramePrincipale
JAVAMAIL : lib/activation.jar;lib/mail.jar;lib/smtp.jar;lib/dns.jar;lib/imap.jar;lib/pop3.jar
ENTREPRISE :lib/entreprise.jar
CLASSES :TestSmtp.jar
MAIN_CLASSE :com.entreprise.frames.FramePrincipale
com.entreprise.frames.FramePrincipalel.jar;lib/smtp.jar;lib/dns.jar;lib/imap.jar;lib/pop3.jarlib/entreprise.jar


il semble qu'il y ait une erreur d'affichage pour le tout mais il me semble qu'il doit planter parce qu'il n'y a rien qui separe pop3.jar de lib/entreprise.jar ..
qdqdfqfdqdxcwcrzsdfw est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 11h27   #15
Membre actif
 
Avatar de Fango
 
Inscription : décembre 2005
Messages : 197
Détails du profil
Informations personnelles :
Âge : 28

Informations forums :
Inscription : décembre 2005
Messages : 197
Points : 178
Points : 178
tu peux tester en ecrivant "en dur" les chemins apres -cp et voir ce qui passe...
Fango est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2007, 11h43   #16
Candidat au titre de Membre du Club
 
Inscription : janvier 2007
Messages : 50
Détails du profil
Informations forums :
Inscription : janvier 2007
Messages : 50
Points : 13
Points : 13
Code :
1
2
3
4
5
6
7
8
9
#!/bin/sh
export JAVAMAIL="lib/activation.jar;lib/mail.jar;lib/smtp.jar;lib/dsn.jar;lib/imap.jar;lib/pop3.jar"
export ENTREPRISE=lib/entreprise.jar
 
export CLASSES=TestSmtp.jar
 
export MAIN_CLASSE=com.entreprise.frames.FramePrincipale
 
"/usr/local/jdk1.5.0_09/jre/bin/java" -classpath lib/activation.jar;lib/mail.jar;lib/smtp.jar;lib/dsn.jar;lib/imap.jar;lib/pop3.jar;lib/entreprise.jar;TestSmtp.jar com.entreprise.frames.FramePrincipale
resultat :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
 
where options include:
    -d32          use a 32-bit data model if available
 
    -d64          use a 64-bit data model if available
    -client       to select the "client" VM
    -server       to select the "server" VM
    -hotspot      is a synonym for the "client" VM  [deprecated]
                  The default VM is client.
 
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose[:class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
timmy.sh: line 6: lib/mail.jar: cannot execute binary file
timmy.sh: line 6: lib/smtp.jar: cannot execute binary file
timmy.sh: line 6: lib/dsn.jar: cannot execute binary file
timmy.sh: line 6: lib/imap.jar: cannot execute binary file
timmy.sh: line 6: lib/pop3.jar: cannot execute binary file
timmy.sh: line 6: lib/entreprise.jar: cannot execute binary file
timmy.sh: line 6: TestSmtp.jar: command not found
[edit] J'ai trouvé, il faut séparer les jars par :

merci a tous
qdqdfqfdqdxcwcrzsdfw est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 03h50.


 
 
 
 
Partenaires

Hébergement Web