IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Shell et commandes GNU Discussion :

Conversion BAT to SH


Sujet :

Shell et commandes GNU

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 50
    Points : 26
    Points
    26
    Par défaut Conversion BAT to SH
    Bonjour j'ai un fichier bat que je voudrai traduire en.sh

    la bat :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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

    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

  2. #2
    Membre actif Avatar de Fango
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    197
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 197
    Points : 205
    Points
    205
    Par défaut
    Salut qdq! c'est pas des export plutot qu'il faut faire a la place des set?

  3. #3
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 50
    Points : 26
    Points
    26
    Par défaut
    J'ai essayé

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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

    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

  4. #4
    Expert confirmé
    Avatar de becket
    Profil pro
    Informaticien multitâches
    Inscrit en
    Février 2005
    Messages
    2 854
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Informaticien multitâches
    Secteur : Service public

    Informations forums :
    Inscription : Février 2005
    Messages : 2 854
    Points : 5 915
    Points
    5 915
    Par défaut
    export VARIABLE et pas export $VARIABLE dans ce cas

  5. #5
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 50
    Points : 26
    Points
    26
    Par défaut
    je m'etais rendu compte de l'erreur entre temps

  6. #6
    Modérateur
    Avatar de al1_24
    Homme Profil pro
    Retraité
    Inscrit en
    Mai 2002
    Messages
    9 110
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 63
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Retraité
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2002
    Messages : 9 110
    Points : 28 447
    Points
    28 447
    Par défaut
    Dans ta conversion, tu as oublié les ; à la fin des définitions de JAVAMAIL et ONYME

  7. #7
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 50
    Points : 26
    Points
    26
    Par défaut
    avec les ;

    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

  8. #8
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 50
    Points : 26
    Points
    26
    Par défaut
    bon apparemment les command not found proviennent des lignes sans rien
    et des points virgule dans la variable JAVAMAIL

  9. #9
    Membre actif Avatar de Fango
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    197
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 197
    Points : 205
    Points
    205
    Par défaut
    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.

  10. #10
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 50
    Points : 26
    Points
    26
    Par défaut
    bon il manquait jre entre java_home et bin, mais ca ne resoud rient

  11. #11
    Expert confirmé
    Avatar de becket
    Profil pro
    Informaticien multitâches
    Inscrit en
    Février 2005
    Messages
    2 854
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Informaticien multitâches
    Secteur : Service public

    Informations forums :
    Inscription : Février 2005
    Messages : 2 854
    Points : 5 915
    Points
    5 915
    Par défaut
    tu as "oublié" les "
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
     export JAVAMAIL="lib/activation.jar;lib/mail.jar;lib/smtp.jar;lib/dsn.jar;lib/imap.jar;lib/pop3.jar"

  12. #12
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 50
    Points : 26
    Points
    26
    Par défaut
    avec le nouveau fichier

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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 ....

  13. #13
    Membre actif Avatar de Fango
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    197
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 197
    Points : 205
    Points
    205
    Par défaut
    verifie alors le chemin apres -classpath

  14. #14
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 50
    Points : 26
    Points
    26
    Par défaut
    Nouveau fichier

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    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 ..

  15. #15
    Membre actif Avatar de Fango
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    197
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 197
    Points : 205
    Points
    205
    Par défaut
    tu peux tester en ecrivant "en dur" les chemins apres -cp et voir ce qui passe...

  16. #16
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 50
    Points : 26
    Points
    26
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. BAT pour conversion d'un fichier binaire en .mes
    Par procrastination dans le forum Programmation système
    Réponses: 1
    Dernier message: 14/10/2014, 17h46
  2. Conversion d'un .bat en .sh
    Par valoub21 dans le forum Shell et commandes GNU
    Réponses: 2
    Dernier message: 23/02/2013, 12h12
  3. [JavaService] Conversion d'un .bat
    Par Ghurdyl dans le forum EDI et Outils pour Java
    Réponses: 1
    Dernier message: 04/05/2011, 22h24
  4. [conversion bat en vbs]
    Par duchmul dans le forum VBScript
    Réponses: 2
    Dernier message: 20/01/2010, 10h43
  5. Conversion .bat en shell
    Par luc2verga dans le forum Linux
    Réponses: 2
    Dernier message: 05/08/2004, 18h29

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo