lundi 3 août 2020

Compile Java project that uses jni heavily to a wasm module and use it in the browser

I have an oldish Java application and I want to rewrite the front end so it will run in the browser. I completely understand the old front code will be thrown out. Because of performance reasons I don't think it work very well as a server-sided application. The application is for 3D modeling and I fear sending rendering data and doing simulations will be to tasking for any reasonably amount connections to the server. What I was thinking is why we can't just compile the java code to a wasm module and c++ code(depended by jni) also to wasm module and dynamically link them. Then I can use the core logic for my application in javascript and get it working in the browser. So with that said here are my questions. Is this even possible? Any documentation or example? How would I go about it if I had to do it myself? Would server-side application actually work?

Extra details I wanted to document just incase.

List of things I found that may help but I don't know how to but it all together:

  • JWebAssembly - compile java code to wasm
  • TeaVM - compile java code to wasm
  • ByteCoder - compile java code to wasm
  • clang - ability to compile wasm and dynamic linking
  • Ecmascript - ability to compile wasm and dynamic linking

List of failed things with reasons:

  • TeaVM - Doesn't seem to support jni
  • ByteCoder - again doesn't seem to support jni
  • bck2brwser - again doesn't seem to support jni
  • GWT - again doesn't seem to support jni
  • Vaadin - My application would be to expensive and slow to run as a server sided app

Links

I eagerly await to see what people think. Thanks!




Aucun commentaire:

Enregistrer un commentaire