Using TeaVM to run LT under JavaScript

Hello!

This page states that developers tried to compile LT to JavaScript using TeaVM and failed to get the working result. I want to know what kind of errors they received. Could I help to improve TeaVM in order to compile LT properly?

Hi,

there’s a page at TeaVM that describes the missing parts: http://teavm.org/jcl-support/0.2.x/jcl.html. As you can see, quite a lot is still missing. The regular expressions would be especially important for LanguageTool.

Regards
Daniel

Did you try to compile with the latest version built from git repository? Regexps are now available in TeaVM.

That’s great - I tried with “-DarchetypeVersion=0.2.1” as documented on teavm.org. Is there a snapshot that can be used so I don’t have to compile it myself?

I don’t publish snapshot versions. You can clone TeaVM repository yourself (GitHub - konsoletyper/teavm: Compiler of Java bytecode to JavaScript) and build it via mvn install -DskipTests. Or you can post me your project and I’ll try to compile it. Sometimes it is impossible to compile some code, but it becomes possible with some hacks.

Thanks, I’ll try it later today or tomorrow.

Here’s the current list of methods and classes that are still missing according to the output of “mvn package”:

[ERROR] Class java.io.FileInputStream was not found
[ERROR] Class java.io.FileOutputStream was not found
[ERROR] Class java.io.File was not found
[ERROR] Class java.net.Authenticator was not found
[ERROR] Class java.net.JarURLConnection was not found
[ERROR] Class java.net.MalformedURLException was not found
[ERROR] Class java.net.URL was not found
[ERROR] Class java.security.AccessController was not found
[ERROR] Class java.security.PrivilegedActionException was not found
[ERROR] Class java.text.Normalizer$Form was not found
[ERROR] Class java.util.concurrent.ArrayBlockingQueue was not found
[ERROR] Class java.util.concurrent.atomic.AtomicInteger was not found
[ERROR] Class java.util.concurrent.ConcurrentHashMap was not found
[ERROR] Class java.util.EmptyStackException was not found
[ERROR] Class java.util.EnumMap was not found
[ERROR] Class java.util.EnumSet was not found
[ERROR] Class java.util.Properties was not found
[ERROR] Class java.util.ResourceBundle was not found
[ERROR] Class java.util.Scanner was not found
[ERROR] Class java.util.WeakHashMap was not found
[ERROR] Class java.util.zip.ZipInputStream was not found
[ERROR] Method java.lang.Class.getCanonicalName()Ljava/lang/String; was not found
[ERROR] Method java.lang.Class.getConstructor([Ljava/lang/Class;)Ljava/lang/reflect/Constructor; was not found
[ERROR] Method java.lang.Class.getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; was not found
[ERROR] Method java.lang.Class.getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; was not found
[ERROR] Method java.lang.Class.getResourceAsStream(Ljava/lang/String;)Ljava/io/InputStream; was not found
[ERROR] Method java.lang.Class.getResource(Ljava/lang/String;)Ljava/net/URL; was not found
[ERROR] Method java.lang.Class.getSimpleName()Ljava/lang/String; was not found
[ERROR] Method java.lang.ClassLoader.getResourceAsStream(Ljava/lang/String;)Ljava/io/InputStream; was not found
[ERROR] Method java.lang.ClassLoader.getResources(Ljava/lang/String;)Ljava/util/Enumeration; was not found
[ERROR] Method java.lang.ClassLoader.getSystemResourceAsStream(Ljava/lang/String;)Ljava/io/InputStream; was not found
[ERROR] Method java.lang.ClassLoader.loadClass(Ljava/lang/String;)Ljava/lang/Class; was not found
[ERROR] Method java.lang.String.toLowerCase(Ljava/util/Locale;)Ljava/lang/String; was not found
[ERROR] Method java.lang.String.toUpperCase(Ljava/util/Locale;)Ljava/lang/String; was not found
[ERROR] Method java.lang.System.getSecurityManager()Ljava/lang/SecurityManager; was not found
[ERROR] Method java.lang.Thread.getContextClassLoader()Ljava/lang/ClassLoader; was not found
[ERROR] Method java.nio.charset.Charset.isSupported(Ljava/lang/String;)Z was not found
[ERROR] Method java.util.zip.ZipEntry.getName()Ljava/lang/String; was not found

This does not mean anything. I’d like to see full stacks. Could you send me it by email (info@teavm.org) or send the project so that I could built it myself and see them? I could not compile GraphHopper, but when I made alternative implementations of couple of interfaces, I could get working application. Another example is libGDX, which uses several classes that are not implemented in TeaVM (and can’t be implemented in browser environment at all), but it is possible to make some little hacks.