04 01 2009
Mac Book Pro + Eclipse + Java SE 1.6 par défaut
Par Laurent BARESSE, à 22:08
L'utilisation d'Eclipse avec le JDK 1.6 configuré par défaut n'est pas directe sous Mac OS X.
Installation de Java SE 1.6 par défaut pour Mac OS X
Par défaut, le Mac Book est configuré pour fonctionner avec le JDK 1.5 même si le JDK 1.6 est installé. Il est cependant possible de choisir quel JDK est utilisé par défaut à l'aide de l'application "Préférences Java" disponible dans Applications/Utilitaires :

Il faut ensuite modifier le lien CurrentJDK comme ceci dans le répertoire :
% ls -l /System/Library/Frameworks/JavaVM.framework/Versions/
lrwxr-xr-x 1 root wheel 5 Dec 24 15:22 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 Jul 18 10:51 1.3.1
lrwxr-xr-x 1 root wheel 5 Dec 24 15:22 1.4 -> 1.4.2
lrwxr-xr-x 1 root wheel 3 Nov 7 10:06 1.4.1 -> 1.4
drwxr-xr-x 8 root wheel 272 Nov 7 10:06 1.4.2
lrwxr-xr-x 1 root wheel 5 Dec 24 15:22 1.5 -> 1.5.0
drwxr-xr-x 9 root wheel 306 Dec 24 15:36 1.5.0
lrwxr-xr-x 1 root wheel 5 Dec 24 15:22 1.6 -> 1.6.0
drwxr-xr-x 8 root wheel 272 Dec 24 15:22 1.6.0
drwxr-xr-x 8 root wheel 272 Dec 24 15:22 A
lrwxr-xr-x 1 root wheel 1 Dec 24 15:22 Current -> A
lrwxr-xr-x 1 root wheel 3 Jan 4 17:03 CurrentJDK -> 1.6
En ouvrant un terminal, si on tape : > % java -version on doit voir apparaitre :
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)
Maintenant le JDK 1.6 est bien celui qui sera utilisé par défaut.
Eclipse crashe
Maintenant si on tente de lancer Eclipse on obtient un mystérieux message : “JVM Terminated. Exit code=-1″ avec pleins d'options comme indiqué dans l'image ci-dessous :

En lançant Eclipse en ligne de commande on obtient :
2008-05-09 10:53:55.443 eclipse[257:10b] Cannot find executable for CFBundle 0×116030 (not loaded)
ou alors :
_NSJVMLoadLibrary: NSAddLibrary failed for /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Libraries/libjvm.dylib JavaVM FATAL: Failed to load the jvm library.
Eclipse a besoin du JDK 1.5 pour fonctionner. Il y a post, Running Eclipse on MacBooks with Java 6 , écrit par “rkischuk,” qui explique pourquoi le 1.6 n'est pas compatible avec les bindings 32-bit de SWT-Cocoa, et donc pourquoi Eclipse crash.
Le Trick pour que cela marche
- Ouvrir un terminal et aller dans le répertoire contenant les fichiers d'Eclipse : Eclipse.app/ configuration/ eclipse@ features/ p2/ readme/ artifacts.xml dropins/ epl-v10.html notice.html plugins/
- Editer le fichier Eclipse.app/Contents/Info.plist
- Décommenter la ligne (31) :
<string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java</string>
- Lancez Eclipse, ça marche !
Posté dans General | aucun commentaire »
