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

Java Discussion :

Exporter JAR google dans le Jar de mon application


Sujet :

Java

  1. #1
    Candidat au Club
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    6
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 6
    Points : 2
    Points
    2
    Par défaut Exporter JAR google dans le Jar de mon application
    Bonjour,

    J'ai un ptit probleme. En faite c'est que j'utilise l'API translate de google pour effectuer des traductions, ça marche impec lorsque je lance mon application depuis eclipse,mais après avoir créé un .jar j'ai plus de connexion à google.

    Pouvez-vous m'aider??

    Merci d'avance, j'ai vraiment besoin de vous

  2. #2
    Expert éminent sénior
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 44
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Points : 12 977
    Points
    12 977
    Par défaut
    Sans l'exception que ton jar lance il nous sera difficile de t'aider.

    Bon sinon pour l'utilisation d'une librairie avec un jar, il faut que celle ci soit renseignée au niveau du classpath de ton jar.

    C'est à dire qu'il faut que son adresse soit renseignée dans l'attribut Class-Path du fichier MANIFEST.MF de ton jar.

    Class-Path: MyUtils.jar

    si le jar de l'API google se trouve au même niveau que ton jar
    ou
    Class-Path: lib/MyUtils.jar si le jar de l'API google se trouve dans le sous répertoire lib du répertoire qui contient ton jar

    cf http://java.sun.com/docs/books/tutor...r/downman.html
    Hey, this is mine. That's mine. All this is mine. I'm claiming all this as mine. Except that bit. I don't want that bit. But all the rest of this is mine. Hey, this has been a really good day. I've eaten five times, I've slept six times, and I've made a lot of things mine. Tomorrow, I'm gonna see if I can't have sex with something.

  3. #3
    Candidat au Club
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    6
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 6
    Points : 2
    Points
    2
    Par défaut
    Merci de ta reponse,

    En fait le truc c'est que j'ai pas d'erreur, il traduit tout simplement rien.
    J'ai pourtant essayé de faire ce que tu m'as conseillé.

  4. #4
    Expert éminent sénior
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 44
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Points : 12 977
    Points
    12 977
    Par défaut
    Même quand tu lances le jar en ligne de commande?
    Hey, this is mine. That's mine. All this is mine. I'm claiming all this as mine. Except that bit. I don't want that bit. But all the rest of this is mine. Hey, this has been a really good day. I've eaten five times, I've slept six times, and I've made a lot of things mine. Tomorrow, I'm gonna see if I can't have sex with something.

  5. #5
    Candidat au Club
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    6
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 6
    Points : 2
    Points
    2
    Par défaut
    Effectivement j'ai des erreurs en lançant le jar en ligne de commande.
    il me dit :
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:com/google/api/translate/Translate
    C:\Documents and Settings\p0715\Bureau\Nouvelle Interface>java -jar interface.jar

    voila toutes les erreurs:::


    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
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
     
     chargement.......
     veuillez patienter quelques secondes....
     
    Demarrage ok
    WARNING: No known abbreviations for language 'fr', attempting fall-back to Engli
    sh version...
    ERROR: No abbreviations files found in ./nonbreaking_prefixes
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/googl
    e/api/translate/Translate
            at google.TraductionGoogle.getTraductionLigneGoogle(TraductionGoogle.jav
    a:95)
            at modele.MSourceTraduction.changeTexte(MSourceTraduction.java:182)
            at controleur.CIInterfacePrincipale.insertUpdate(CIInterfacePrincipale.j
    ava:355)
            at javax.swing.text.AbstractDocument.fireInsertUpdate(Unknown Source)
            at javax.swing.text.AbstractDocument.handleInsertString(Unknown Source)
            at javax.swing.text.AbstractDocument.insertString(Unknown Source)
            at javax.swing.text.PlainDocument.insertString(Unknown Source)
            at javax.swing.text.AbstractDocument.replace(Unknown Source)
            at javax.swing.text.JTextComponent.replaceSelection(Unknown Source)
            at javax.swing.text.DefaultEditorKit$InsertBreakAction.actionPerformed(U
    nknown Source)
            at javax.swing.plaf.basic.BasicTextUI$TextActionWrapper.actionPerformed(
    Unknown Source)
            at javax.swing.SwingUtilities.notifyAction(Unknown Source)
            at javax.swing.JComponent.processKeyBinding(Unknown Source)
            at javax.swing.JComponent.processKeyBindings(Unknown Source)
            at javax.swing.JComponent.processKeyEvent(Unknown Source)
            at java.awt.Component.processEvent(Unknown Source)
            at java.awt.Container.processEvent(Unknown Source)
            at java.awt.Component.dispatchEventImpl(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
            at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
     
            at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Sour
    ce)
            at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Sour
    ce)
            at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
            at java.awt.Component.dispatchEventImpl(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Window.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.EventQueue.dispatchEvent(Unknown Source)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: com.google.api.translate.Translate
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
            ... 36 more
    arrêt en cours...
    Arr├¬t de l'├®coute de la socket
    ... ok

  6. #6
    Expert éminent sénior
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 44
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Points : 12 977
    Points
    12 977
    Par défaut
    Traduction: ton classpath est mal configuré.

    Qu'as tu renseigné dans le fichier manifest, et où se trouve le jar de l'API Google par rapport à ton jar?
    Hey, this is mine. That's mine. All this is mine. I'm claiming all this as mine. Except that bit. I don't want that bit. But all the rest of this is mine. Hey, this has been a really good day. I've eaten five times, I've slept six times, and I've made a lot of things mine. Tomorrow, I'm gonna see if I can't have sex with something.

  7. #7
    Candidat au Club
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    6
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 6
    Points : 2
    Points
    2
    Par défaut
    Je fais creer un manifeste par eclipse , je coche "generate manifest"
    J'ai egalement tenté de creer mon manifest qui contient
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Manifest-Version: 1.0
    Main-Class: vue.LancerTransDemo
    Class-Path: google-api-translate-java-0.51.jar
    sinon ben mon JAR est ds le meme repertoire ke le jar de google , qui sont a la racine du projet

Discussions similaires

  1. Images dans un JAR (tout dans un seul exécutable)
    Par jujusous3 dans le forum Eclipse Java
    Réponses: 8
    Dernier message: 21/02/2010, 00h02
  2. Inclusion d'un fichier properties dans un jar avec la commande jar
    Par Lolitaaa dans le forum Général Java
    Réponses: 3
    Dernier message: 15/12/2009, 14h17
  3. Jar inclus dans un Jar ou pas?
    Par lextaz33 dans le forum Général Java
    Réponses: 2
    Dernier message: 30/09/2009, 11h24
  4. Charger les classes d'un Jar incluses dans un Jar
    Par daronmaster dans le forum Général Java
    Réponses: 2
    Dernier message: 08/06/2009, 22h11
  5. Réponses: 3
    Dernier message: 09/07/2008, 10h29

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