1

Just installed transcrypt. Autotest compilation succeeds but fails at minification. I tried updating to JRE 8, but same error. Any advice for making it work?

Thanks!

$ 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
Mike Ellis
  • 1,120
  • 1
  • 12
  • 27

1 Answers1

1

From the your console output it seems that, while you installed JRE 8, your system still uses JRE 6:

$ 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)

Since you'r on Apple, there should be a "system preferences" dialog. As soon as there's more than one version of the JRE on you machine, there should be an item in this dialog that allows you to change the settings for Java, including which version it will default to.

See also:

java.lang.UnsupportedClassVersionError

You can also change these settings via the command line, see:

How to set or change the default Java (JDK) version on OS X?

Community
  • 1
  • 1
Jacques de Hooge
  • 6,750
  • 2
  • 28
  • 45
  • Thanks, Jacques. The links pointed me in the right direction. I ended up fixing it by finding the new java executable and creating a symlink to it in my virtual environment. Compiling autotest.py now completes and generates a minified file. – Mike Ellis Apr 17 '17 at 19:47