konsoletyper / teavm

Compiles Java bytecode to JavaScript, WebAssembly and C
https://teavm.org
Apache License 2.0
2.56k stars 262 forks source link

Does teaVM support Socket and JavaCV #514

Open JianLinWei1 opened 4 years ago

JianLinWei1 commented 4 years ago

Does teaVM support Socket and JavaCV

ScraM-Team commented 4 years ago

TeaVM allows HTTP calls using the browser APIs and REST wrappers. You can also access browser APIs for WebSockets.

I don't know of anyone who has made JavaCV bindings. Does it require native code?

What are you trying to do? If we knew more about your project we could give more complete advice.

aghasemi commented 3 years ago

Does it require native code?

I assume TeaVM can't work with dependencies that contain native code. Right?

konsoletyper commented 3 years ago

I assume TeaVM can't work with dependencies that contain native code. Right?

Right

aghasemi commented 3 years ago

Thanks. Makes total sense.

aghasemi commented 3 years ago

Hi again,

Does this error mean one of the dependencies has native code?

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project TVM: Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags -> [Help 1]

konsoletyper commented 3 years ago

Have no idea. It's only short part of some Maven output. How can I make conclusions? I see that error is thrown from within maven-compiler-plugin, does this mean that you hit a bug in Java compiler?

aghasemi commented 3 years ago

Thanks, now that you are online :) I see this error when adding Apache OpenNLP as a dependency:

[ERROR] Failed to execute goal org.teavm:teavm-maven-plugin:0.6.1:compile (web-client) on project TVM: Unexpected error occurred: Unsupported class file major version 58 -> [Help 1]

Already tried different version of the library and different values for java.version. Any idea?

konsoletyper commented 3 years ago

Looks like bytecode version you feed to TeaVM is not supported. I don't remember exact version of Java supported by TeaVM, perhaps it's around 13 or 14

aghasemi commented 3 years ago

Class file major version 58 is for Java 14. Will update here if I manage to solve it.

P.S. TeaVM apparently works with up to Java 13.

aghasemi commented 3 years ago

Update: Using JDK 11 instead of 14 as compiler solved that issue. java.version didn't help.

So apparently they call it LTS for a reason!