刚刚安装了transcrypt。自动汇编成功,但在缩小时失败。我尝试更新为JRE 8,但同样的错误。有什么建议可以使其起作用?
谢谢!
$ uname -a
Darwin Michaels-Mac-mini 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan 9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64
$ python --version
Python 3.5.1 :: Anaconda 4.0.0 (x86_64)
$ transcrypt -h
Transcrypt (TM) Python to JavaScript Small Sane Subset Transpiler Version 3.6.24
Copyright (C) Geatec Engineering. License: Apache 2.0
$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)
$ transcrypt -b autotest.py
Transcrypt (TM) Python to JavaScript Small Sane Subset Transpiler Version 3.6.24
Copyright (C) Geatec Engineering. License: Apache 2.0
Saving result in: /Users/mellis/anaconda3/lib/python3.5/site-packages/transcrypt/development/automated_tests/transcrypt/__javascript__/autotest.js
Saving minified result in: /Users/mellis/anaconda3/lib/python3.5/site-packages/transcrypt/development/automated_tests/transcrypt/__javascript__/autotest.min.js
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CommandLineRunner : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Ready
从您的控制台输出中,似乎在安装JRE 8时,您的系统仍然使用JRE 6:
$ java -version
Java版本" 1.6.0_65"
Java(TM(SE运行时环境(构建1.6.0_65-B14-468-11M4833(
Java热点(TM(64位服务器VM(构建20.65-B04-468,混合模式(
由于您在Apple上,应该有一个"系统首选项"对话框。一旦机器上有多个版本的JRE版本,该对话框中应该有一个项目,使您可以更改Java的设置,包括它默认为。
。另请参见:
java.lang.unsupportedClassversionError
您还可以通过命令行更改这些设置,请参见:
如何在OS X上设置或更改默认Java(JDK(版本?