leaningtech / cheerpj-meta

Run Java 8 applications, libraries, applets, Java Web Start, and Oracle Forms on the web without legacy plugins.
https://labs.leaningtech.com/cheerpj
434 stars 21 forks source link

Can't load classes with non-ascii names #195

Closed F43nd1r closed 2 months ago

F43nd1r commented 2 months ago

Cheerpj fails with ClassNotFoundException when trying to load a class with special characters.

Reproducer:

  1. Add to same directory

    • javaslang-2.0.6.jar
    • index.html:
      <!doctype html>
      <html>
      <head>
      <title>Hello CheerpJ</title>
      <script src="https://cjrtnc.leaningtech.com/3.0/cj3loader.js"></script>
      <meta charset="utf-8"/>
      </head>
      <body>
      Hello CheerpJ
      <script>
      async function test() {
      await cheerpjInit();
      const lib = await cheerpjRunLibrary("/app/javaslang-2.0.6.jar")
      try {
          await lib.javaslang.λ
      } catch (e) {
          console.error(`${await (await e.getClass()).getName()} ${await e.getMessage()}`)
      }
      }
      test()
      </script>
      </body>
      </html>
  2. serve directory, e.g. with npx http-server

  3. Open served site in browser and observe error in console:

    CheerpJ runtime ready [cj3.js:1:79529](https://cjrtnc.leaningtech.com/3.0/cj3.js)
    java.lang.ClassNotFoundException javaslang.뀁 [127.0.0.1:8080:17:21](http://127.0.0.1:8080/)
    test http://127.0.0.1:8080/:17
    <anonymous> http://127.0.0.1:8080/:20

Note that this is just a reproducer - in my real application javaslang is a transitive dependency which is why I'm unable to rename the class or replace its usage.

alexp-sssup commented 2 months ago

The problem is already fixed in nightly builds, please try again with: https://cjrtnc.leaningtech.com/3_20240416_465/cj3loader.js

For further questions please consider joining our discord: https://discord.gg/X9ruPkchM5