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

Eclipse Platform Discussion :

FileLocator et path


Sujet :

Eclipse Platform

  1. #1
    Expert confirmé Avatar de ManusDei
    Homme Profil pro
    vilain troll de l'UE
    Inscrit en
    Février 2010
    Messages
    1 619
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : vilain troll de l'UE

    Informations forums :
    Inscription : Février 2010
    Messages : 1 619
    Points : 4 350
    Points
    4 350
    Par défaut FileLocator et path
    Bonjour,

    je développe sous windows, pour un plugin windows, mais quand je tente de charger une dll dans mon plugin, il la cherche sur un path "linux".

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    public void start(BundleContext context) throws Exception {
    	super.start(context);
    	String path;
    	// build OJAWA path
    	String os = java.lang.System.getProperty("os.name");
    	if(os.equals("Linux")){
    		path = FileLocator.toFileURL(FileLocator.find(context.getBundle(), new Path("/"), null)).getPath();
    		path = path + "/libotawa/lib/libojawa.so";
    	}
    	else if(os.startsWith("Windows")){
    		path = FileLocator.toFileURL(FileLocator.find(context.getBundle(), new Path(""), null)).toString();
    		path = path + "libotawa/bin/libojawa.dll";
    	}
    A la sortie de tout ça, dans la variable path, j'ai

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    /D:/Lecourt/workspace/ADTREE/libotawa/bin/libojawa.dll
    Donc j'ai le / avant D: qui "gêne".
    D'où vient-il ?
    D'après ce que j'ai lu dans la javadoc, le BundleContext est crée par Eclipse et représente l'environnement à ce moment là.
    http://www.traducteur-sms.com/ On ne sait jamais quand il va servir, donc il faut toujours le garder sous la main

  2. #2
    Membre expert
    Avatar de Gueritarish
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mai 2007
    Messages
    1 800
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2007
    Messages : 1 800
    Points : 3 919
    Points
    3 919
    Par défaut
    Salut,

    Tu cherches à obtenir quoi dans un premier temps?
    L'endroit où est situé le Bundle?
    Je comprends pas ton utilisation du FileLocator là...

    [EDIT:] Parce que là, en plus, tu vas obtenir 2 comportements différents:
    • un au runtime Eclipse, là, tu vas obtenir l'emplacement de ton projet dans le workspace
    • et un autre lors de l'utilisation "normale" qui va correspondre à en emplacement dans les metadata (à priori)

    Si ton but c'est d'utiliser la bonne bibliothèques, pourquoi ne pas placer le dossier contenant tes libs dans le classpath?

    Voilà, à+
    Gueritarish
    Pas de questions technique par MP, les forums sont là pour ça.

  3. #3
    Expert confirmé Avatar de ManusDei
    Homme Profil pro
    vilain troll de l'UE
    Inscrit en
    Février 2010
    Messages
    1 619
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : vilain troll de l'UE

    Informations forums :
    Inscription : Février 2010
    Messages : 1 619
    Points : 4 350
    Points
    4 350
    Par défaut
    Je débute totalement sur les plugin Eclipse, donc j'avance un peu à tâton (et je reprend un plugin déjà fait).

    J'ai un projet C++, avec lequel je crée des dll.
    Avec une JNI, je linke le C++ au JAVA, et j'en fait un plugin intégré à Eclipse.

    Le plugin existe et fonctionne sous Linux, et je fais le portage Windows.

    Quand on passe Eclipse en perspective "OTAWA", il doit charger libotawa.dll (et sous linux il chargeait libotawa.so).

    Le FileLocator doit donc trouver l'endroit où est le Bundle, et à partir de ça je rajoute le chemin vers la lib.

    Juste après mon premier bout de code, je charge la bibliothèque à partir du path construit.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    try {
    	System.load(path);
    }
    Edit : Le plug-in est à "installer" dans le dossier dropins.
    http://www.traducteur-sms.com/ On ne sait jamais quand il va servir, donc il faut toujours le garder sous la main

  4. #4
    Membre expert
    Avatar de Gueritarish
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mai 2007
    Messages
    1 800
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2007
    Messages : 1 800
    Points : 3 919
    Points
    3 919
    Par défaut
    Donc, si j'ai bien compris, tu as un plug-in que tu installes dans le dossier "dropins" et tu dois charger une dll qui est: incluses dans le jar du plug-in? ou dans le dossier "dropins"?
    Tu peux utiliser le répertoire d'installation d'Eclipse?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Platform.getInstallLocation().getURL();
    Ensuite construire ton path à partir de là. Mais ça me paraît être une solution bancale...
    Pas de questions technique par MP, les forums sont là pour ça.

  5. #5
    Expert confirmé Avatar de ManusDei
    Homme Profil pro
    vilain troll de l'UE
    Inscrit en
    Février 2010
    Messages
    1 619
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : vilain troll de l'UE

    Informations forums :
    Inscription : Février 2010
    Messages : 1 619
    Points : 4 350
    Points
    4 350
    Par défaut
    La dll est dans le dossier eclipse/dropins/[des dossiers en cascade]/otawa/libotawa/

    Par contre ce que j'ai de sûr, c'est que par rapport au fichier .class qui charge la dll, le chemin relatif est ../libotawa/libotawa.dll

    Ce que je ne comprend pas dans tout ça, c'est que sous Linux ça fonctionne, il trouve libotawa.so, alors que sous windows je n'arrive pas, avec un code qui me semble équivalent, à faire la même chose, c'est à dire trouver libotawa.dll
    http://www.traducteur-sms.com/ On ne sait jamais quand il va servir, donc il faut toujours le garder sous la main

  6. #6
    Expert confirmé Avatar de ManusDei
    Homme Profil pro
    vilain troll de l'UE
    Inscrit en
    Février 2010
    Messages
    1 619
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : vilain troll de l'UE

    Informations forums :
    Inscription : Février 2010
    Messages : 1 619
    Points : 4 350
    Points
    4 350
    Par défaut
    En fait je peux tout simplement faire un .jar à partir du projet, et le rajouter dans eclipse/dropins/otawa/plugins/monjar.jar

    Mais il ne trouve pas ma dll, qui est dans libotawa/lib/libotawa.dll (libotawa est au même niveau que le dossier src, et j'ai réorganisé les dossiers).

    C'est donc pas vraiment un problème Eclipse, mais un problème Java, non ?
    http://www.traducteur-sms.com/ On ne sait jamais quand il va servir, donc il faut toujours le garder sous la main

  7. #7
    Membre averti
    Homme Profil pro
    Dev
    Inscrit en
    Novembre 2006
    Messages
    112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev

    Informations forums :
    Inscription : Novembre 2006
    Messages : 112
    Points : 350
    Points
    350
    Par défaut
    Bonjour

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    String s = 
    ((org.eclipse.osgi.framework.internal.core.AbstractBundle)  
     context.getBundle()).
    getBundleData().findLibrary("name");
    System.load(new File(s).toString());
    Avec ce code tu chargeras (sous linux: libname.so;
    sous windows : name.dll ; sous mac : libname.jnilib) qui se trouve à la racine de ton plugins .



    La méthode findLibrary permet de récupérer la localisation de la librairie. ( si elle est dans une archive , elle sera décompressé dans un répertoire d'eclipse ).

  8. #8
    Expert confirmé Avatar de ManusDei
    Homme Profil pro
    vilain troll de l'UE
    Inscrit en
    Février 2010
    Messages
    1 619
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : vilain troll de l'UE

    Informations forums :
    Inscription : Février 2010
    Messages : 1 619
    Points : 4 350
    Points
    4 350
    Par défaut
    En suivant ton conseil,

    je remplace par :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    else if(os.startsWith("Windows")){
    			String s = ((org.eclipse.osgi.framework.internal.core.AbstractBundle) context.getBundle()).getBundleData().findLibrary("name");
    			path = new File(s).toString();
    		}
    Et j'obtiens un message d'erreur assez incompréhensible :s

    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
    !SESSION 2011-05-11 10:26:41.346 -----------------------------------------------
    eclipse.buildId=M20110210-1200
    java.version=1.6.0_24
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR
    Framework arguments:  -product org.eclipse.sdk.ide
    Command-line arguments:  -product org.eclipse.sdk.ide -data D:\Lecourt\workspace/../runtime-EclipseApplication -dev file:D:/Lecourt/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86 -consoleLog
     
    !ENTRY org.eclipse.osgi 4 0 2011-05-11 10:26:52.674
    !MESSAGE An error occurred while automatically activating bundle OTAWA (2).
    !STACK 0
    org.osgi.framework.BundleException: Exception in adtree.ADTREEPlugin.start() of bundle OTAWA.
    	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
    	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
    	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
    	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
    	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:417)
    	at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:265)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:106)
    	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:453)
    	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
    	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
    Et plein d'autres ligne de même genre.
    Par contre, vu que c'est un problème de Java et non d'Eclipse, j'ai créé une nouvelle discussion.
    http://www.traducteur-sms.com/ On ne sait jamais quand il va servir, donc il faut toujours le garder sous la main

  9. #9
    Membre expert
    Avatar de Gueritarish
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mai 2007
    Messages
    1 800
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2007
    Messages : 1 800
    Points : 3 919
    Points
    3 919
    Par défaut
    Citation Envoyé par ManusDei Voir le message
    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
    !SESSION 2011-05-11 10:26:41.346 -----------------------------------------------
    eclipse.buildId=M20110210-1200
    java.version=1.6.0_24
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR
    Framework arguments:  -product org.eclipse.sdk.ide
    Command-line arguments:  -product org.eclipse.sdk.ide -data D:\Lecourt\workspace/../runtime-EclipseApplication -dev file:D:/Lecourt/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86 -consoleLog
     
    !ENTRY org.eclipse.osgi 4 0 2011-05-11 10:26:52.674
    !MESSAGE An error occurred while automatically activating bundle OTAWA (2).
    !STACK 0
    org.osgi.framework.BundleException: Exception in adtree.ADTREEPlugin.start() of bundle OTAWA.
    	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
    	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
    	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
    	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
    	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:417)
    	at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:265)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:106)
    	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:453)
    	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
    	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
    Et plein d'autres ligne de même genre.
    Alors, c'est sympa de nous mettre la pile d'exécution, mais tu ne nous mets pas la cause de l'erreur. Il doit y avoir une (ou plusieurs) ligne(s) disant: "Caused by ...". Et ce sont celles là qui sont intéressantes. Là, ça nous indique juste qu'il y une exception au démarrage du Bundle...
    Pas de questions technique par MP, les forums sont là pour ça.

  10. #10
    Expert confirmé Avatar de ManusDei
    Homme Profil pro
    vilain troll de l'UE
    Inscrit en
    Février 2010
    Messages
    1 619
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : vilain troll de l'UE

    Informations forums :
    Inscription : Février 2010
    Messages : 1 619
    Points : 4 350
    Points
    4 350
    Par défaut
    Ok. Je reviens sur une question où j'ai mal répondu avant, la dll est dans le jar du plugin.

    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
    public void start(BundleContext context) throws Exception {
    	super.start(context);
    	String path;
    	// build OJAWA path
    	String os = java.lang.System.getProperty("os.name");
    	if(os.equals("Linux")){ }
    	else if(os.startsWith("Windows")){
    		path = FileLocator.toFileURL(FileLocator.find(context.getBundle(), new Path("C:"), null)).getPath();
    		path = path + "libotawa/lib/libojawa.dll";
    	}
    	else { }
    	// link with OJAWA
    	try {
    			System.load(path);
    			logInfo("using relocated OJAWA from " + path);
    	}
    	catch(java.lang.UnsatisfiedLinkError e) {
    		logInfo("can not find relocated OJAWA at " + path + ": attempting from libraries of LD_LIBRARY_PATH.");
    		System.loadLibrary("ojawa");
    	}
     
    // et plein de code après
    }
    Avec ce code, sur la pile j'ai :

    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
    !SESSION 2011-05-11 13:37:12.109 -----------------------------------------------
    eclipse.buildId=M20110210-1200
    java.version=1.6.0_24
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR
    Framework arguments:  -product org.eclipse.sdk.ide
    Command-line arguments:  -product org.eclipse.sdk.ide -data D:\Lecourt\workspace/../runtime-EclipseApplication -dev file:D:/Lecourt/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86 -consoleLog
     
    !ENTRY ADTREE 1 0 2011-05-11 13:38:27.117
    !MESSAGE can not find relocated OJAWA at D:\Lecourt\workspace\ADTREE\libotawa\lib\libojawa.dll: attempting from libraries of LD_LIBRARY_PATH.
     
    !ENTRY org.eclipse.osgi 4 0 2011-05-11 13:38:38.616
    !MESSAGE An error occurred while automatically activating bundle OTAWA (2).
    !STACK 0
    org.osgi.framework.BundleException: Exception in adtree.ADTREEPlugin.start() of bundle OTAWA.
    	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
    	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
    	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
    	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
    	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:417)
    [......]
    	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
    	at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
    Caused by: java.lang.UnsatisfiedLinkError: no ojawa in java.library.path
    	at java.lang.ClassLoader.loadLibrary(Unknown Source)
    	at java.lang.Runtime.loadLibrary0(Unknown Source)
    	at java.lang.System.loadLibrary(Unknown Source)
    	at adtree.ADTREEPlugin.start(ADTREEPlugin.java:225)
    	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
    	... 69 more
    Root exception:
    java.lang.UnsatisfiedLinkError: no ojawa in java.library.path
    	at java.lang.ClassLoader.loadLibrary(Unknown Source)
    [......]
    	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
    	at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
    Les deux exceptions correspondent il me semble aux deux tentatives de chargement de la bibliothèque.

    En utilisant
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    String s = ((org.eclipse.osgi.framework.internal.core.AbstractBundle) context.getBundle()).getBundleData().findLibrary("name");
    			path = new File(s).toString();
    avec le debugger, s = null, et j'ai une exception qui arrête simplement le chargement du plugin quand on tente d'initialiser path, logique vu que l'argument est null.
    http://www.traducteur-sms.com/ On ne sait jamais quand il va servir, donc il faut toujours le garder sous la main

  11. #11
    Expert confirmé Avatar de ManusDei
    Homme Profil pro
    vilain troll de l'UE
    Inscrit en
    Février 2010
    Messages
    1 619
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : vilain troll de l'UE

    Informations forums :
    Inscription : Février 2010
    Messages : 1 619
    Points : 4 350
    Points
    4 350
    Par défaut
    Après quelques recherches sur java.library.path, j'ai ajouté les dll dans mon PATH (pour tester, le but est d'avoir les dll dans le jar).

    Il la trouve au deuxième essai, mais
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    java.lang.UnsatisfiedLinkError: C:\Win16App\MinGW\bin\libojawa.dll: La procédure spécifiée est introuvable
    http://www.traducteur-sms.com/ On ne sait jamais quand il va servir, donc il faut toujours le garder sous la main

  12. #12
    Expert confirmé Avatar de ManusDei
    Homme Profil pro
    vilain troll de l'UE
    Inscrit en
    Février 2010
    Messages
    1 619
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : vilain troll de l'UE

    Informations forums :
    Inscription : Février 2010
    Messages : 1 619
    Points : 4 350
    Points
    4 350
    Par défaut
    Du neuf.
    Si j'exporte le projet en jar, et que je décompresse mon jar avant de mettre les fichiers dans le dossier dropins, j'arrive à retrouver le fichier (je fais un test avec File.exists().

    Donc j'arrive à trouver ma dll, mais pas à la charger.

    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
    	public void start(BundleContext context) throws Exception {
    		super.start(context);
     
    		String path;
    		// build OJAWA path
    		String os = java.lang.System.getProperty("os.name");
    		if(os.equals("Linux")){
    			path = FileLocator.toFileURL(FileLocator.find(context.getBundle(), new Path("/"), null)).getPath();
    			path = path + "/libotawa/lib/libojawa.so";
    		}
    		else if(os.startsWith("Windows")){
    			//path = FileLocator.toFileURL(FileLocator.find(context.getBundle(), new Path("C:"), null)).getPath();
    			path = FileLocator.getBundleFile(context.getBundle()).getAbsolutePath();
    			path = path + "\\libotawa\\lib\\libojawa.dll";
    			//if(new File(path).exists())
    				//path = "file found" + path;
    		}
    		else {
    			path = null;
    			ADTREEPlugin.logError("unsupported OS: OTAWA library shouldn't be accessible.", null);
    		}
    		// link with OJAWA
    		try {
    				System.load(path);
    				logInfo("using relocated OJAWA from " + path);
    		}
    		catch(java.lang.UnsatisfiedLinkError e) {
    			logInfo("can not find relocated OJAWA at " + path + ": attempting from libraries of LD_LIBRARY_PATH.");
    			System.loadLibrary("ojawa");
    		}
    Et j'ai plusieurs messages d'erreur.

    Invalid Zip archive : libotawa/lib/libotawa.dll [in ADTREE]
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    org.eclipse.core.runtime.CoreException: I/O exception
    at org.eclipse.jdt.internal.core.JavaModelManager.getZipFile(JavaModelManager.java:2524)
    at org.eclipse.jdt.internal.core.JarPackageFragmentRoot.getJar(JarPackageFragmentRoot.java:152)
    at org.eclipse.jdt.internal.core.JarPackageFragmentRoot.computeChildren(JarPackageFragmentRoot.java:78)
    [........]
    at org.eclipse.jdt.internal.ui.text.JavaReconciler.initialProcess(JavaReconciler.java:398)
    at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:173)
    Caused by: java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(Unknown Source)
    at java.util.zip.ZipFile.<init>(Unknown Source)
    at org.eclipse.jdt.internal.core.JavaModelManager.getZipFile(JavaModelManager.java:2518)
    ... 27 more
    et le classique
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    can not find relocated OJAWA at D:\eclipse\dropins\OTAWA_1.4.0\plugins\otawa\libotawa\lib\libojawa.dll: attempting from libraries of LD_LIBRARY_PATH.
    et (mais celui là vient de la deuxième partie du code je pense, on devrait en théorie trouver la dll avant)
    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
     
    org.osgi.framework.BundleException: Exception in adtree.ADTREEPlugin.start() of bundle OTAWA.
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
    [.......]
    at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
    Caused by: java.lang.UnsatisfiedLinkError: no ojawa in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at adtree.ADTREEPlugin.start(ADTREEPlugin.java:221)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
    ... 68 more
    Root exception:
    java.lang.UnsatisfiedLinkError: no ojawa in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    [.....]
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
    http://www.traducteur-sms.com/ On ne sait jamais quand il va servir, donc il faut toujours le garder sous la main

  13. #13
    Expert confirmé Avatar de ManusDei
    Homme Profil pro
    vilain troll de l'UE
    Inscrit en
    Février 2010
    Messages
    1 619
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : vilain troll de l'UE

    Informations forums :
    Inscription : Février 2010
    Messages : 1 619
    Points : 4 350
    Points
    4 350
    Par défaut
    Je n'ai pas d'autres idées. Eclipse trouve la bibliothèque, mais apparemment n'arrive pas à la charger, et je n'ai aucune idée du pourquoi.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    !ENTRY ADTREE 1 0 2011-05-12 15:41:46.798
    !MESSAGE can not find relocated OJAWA at D:\Lecourt\workspace\ADTREE\libotawa\lib\libojawa.dll: attempting from libraries of LD_LIBRARY_PATH.
    java.lang.UnsatisfiedLinkError: D:\Lecourt\workspace\ADTREE\libotawa\lib\libojawa.dll: La procédure spécifiée est introuvable
    	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    	at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    http://www.traducteur-sms.com/ On ne sait jamais quand il va servir, donc il faut toujours le garder sous la main

  14. #14
    Expert confirmé Avatar de ManusDei
    Homme Profil pro
    vilain troll de l'UE
    Inscrit en
    Février 2010
    Messages
    1 619
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : vilain troll de l'UE

    Informations forums :
    Inscription : Février 2010
    Messages : 1 619
    Points : 4 350
    Points
    4 350
    Par défaut
    Résolu.

    J'ai plusieurs versions de libxml2 sur ma machine, la première dans le path n'est pas bonne.
    http://www.traducteur-sms.com/ On ne sait jamais quand il va servir, donc il faut toujours le garder sous la main

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

Discussions similaires

  1. [Struts][jsp] probleme de path
    Par vpet dans le forum Servlets/JSP
    Réponses: 2
    Dernier message: 30/03/2004, 18h21
  2. Ajouter des chemins dans la variable PATH
    Par Righetto Dominique dans le forum Linux
    Réponses: 7
    Dernier message: 21/03/2004, 17h38
  3. récupérer le path system
    Par Eugénie dans le forum MFC
    Réponses: 4
    Dernier message: 22/12/2003, 13h03
  4. Réponses: 3
    Dernier message: 10/06/2003, 14h16
  5. Redhat-9 changer le path des databases
    Par jean christophe dans le forum Installation
    Réponses: 7
    Dernier message: 30/05/2003, 17h53

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