メモ」カテゴリーアーカイブ

PPC macでscala

sudo port install scala2.10
でinstallして、起動すると
[~/src/Scala]scala
Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClass0(ClassLoader.java:947)
at java.lang.ClassLoader.loadClass(ClassLoader.java:309)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)
[~/src/Scala]java -version
java version “1.5.0_30”
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_30-b03-389-9M3425)
Java HotSpot(TM) Client VM (build 1.5.0_30-161, mixed mode, sharing)
で動きません。Java for Mac OS X 10.5 Update 10まであててますが、ppcなので上記バージョンです。
[~/]ls -l /System/Library/Frameworks/JavaVM.framework/Versions/
total 64
drwxr-xr-x@ 14 root wheel 476 1 31 12:52 ./
drwxr-xr-x@ 12 root wheel 408 1 31 12:52 ../
lrwxr-xr-x 1 root wheel 5 1 31 12:51 1.3@ -> 1.3.1
drwxr-xr-x 3 root wheel 102 9 29 2007 1.3.1/
lrwxr-xr-x 1 root wheel 5 9 5 2009 1.4@ -> 1.4.2
lrwxr-xr-x 1 root wheel 3 11 2 2007 1.4.1@ -> 1.4
drwxr-xr-x@ 8 root wheel 272 1 27 2005 1.4.2/
lrwxr-xr-x 1 root wheel 5 1 31 12:51 1.5@ -> 1.5.0
drwxr-xr-x 8 root wheel 272 11 19 2005 1.5.0/
lrwxr-xr-x 1 root wheel 5 1 31 12:51 1.6@ -> 1.6.0
lrwxr-xr-x 1 root wheel 59 1 31 12:51 1.6.0@ -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
drwxr-xr-x@ 10 root wheel 340 1 31 12:52 A/
lrwxr-xr-x 1 root wheel 1 1 31 12:52 Current@ -> A
lrwxr-xr-x 1 root wheel 3 1 31 12:51 CurrentJDK@ -> 1.5
[~/]file /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java: symbolic link to `../Home/bin/java’
[~/]file /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/../Home/bin/java
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/../Home/bin/java: Mach-O 64-bit x86_64 executable

portsにないようなので、
openjdk7-zerovm-ppc-jyeary-2012-02-16-07-18-b00.zipをdwonloadしてinstallします。
[~/src/Scala]java -version
openjdk version “1.7.0-internal”
OpenJDK Runtime Environment (build 1.7.0-internal-jyeary_2012_02_16_07_18-b00)
OpenJDK Zero VM (build 21.0-b17, interpreted mode)
[~/src/Scala]javac -version
javac 1.7.0-internal
[~/src/Scala]scala
Welcome to Scala version 2.10.3 (OpenJDK Zero VM, Java 1.7.0-internal).
Type in expressions to have them evaluated.
Type :help for more information.

scala> (BigInt(1) to 100).product
res0: BigInt = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000

scala> 1+2
res1: Int = 3

scala> [~/src/Scala]
とりあえず動くようです。