plasma-umass / doppio

Breaks the browser language barrier (includes a plugin-free JVM).
http://plasma-umass.github.io/doppio-demo
MIT License
2.16k stars 175 forks source link

Classes in jar on bootclasspath not found #357

Closed netopyr closed 9 years ago

netopyr commented 9 years ago

I am trying to add a jar to the bootclasspath with Doppio. Unfortunately classes in the jar are not found. Is this functionality supposed to work?

Are there any limits? The jar file has a size of 8.5 MB and contains 6000+ files.

jvilk commented 9 years ago

It should work... do you have BrowserFS included on the page and configured? The JAR file should be somewhere in the BrowserFS file system, and then Doppio should be pointed to its in-browser path on the bootclasspath.

Are there any limits? The jar file has a size of 8.5 MB and contains 6000+ files.

Nope, no limits.

I'm travelling atm, but will take a look at this later tonight to see if recent changes may have broken it!

jvilk commented 9 years ago

I just tried this with the entire Java Class Library in a zip file (40MB+, 25000+ items), and it worked instanteously. Can you share with me the code or code fragment you're using to call doppio? Do you also have the Java Class Library on the path (from doppio_jcl, normally pulled in by our build script in a 'release' build: https://github.com/plasma-umass/doppio_jcl/releases/tag/v2.0).

jvilk commented 9 years ago

Also, I just saw your blog post using JavaFX and Doppio -- awesome! Can you let me know when you use it on any further items? Is the code publicly available?

I'm trying to launch a new demo this weekend to show off our Java 8 and WebWorker support, which will use JARs on the bootclasspath. I also have another idea that will dramatically improve startup time if I can get it working, so stay tuned for that... If your JavaFX code is available somewhere, I would be interested in taking a look to see if I could integrate it into the demo somehow!

Also, a heads up if you have a significant number of native methods: I'm going to change up the JVM object format sometime over the next month to a much more sane format that maps JVM objects to JavaScript objects, which will lead to cleaner native code and likely improved performance. (If you are using TypeScript, the new format will generate TypeScript declaration files for each JVM class, so you can typecheck your natives until they work.)

netopyr commented 9 years ago

Thanks for the fast response. The code is available on BitBucket.

The example: https://bitbucket.org/michael_heinrichs/jfx8web-samples The code that generates the JavaFX Runtime for Doppio: https://bitbucket.org/michael_heinrichs/jfx8web

Though I doubt you will be able to use them out-of-the-box. We are still in a very early PoC stage, trying out which technologies could work. I.e. things are not automated yet and there is no documentation. :)

Here is the link to index.html, where I call Doppio: https://bitbucket.org/michael_heinrichs/jfx8web-samples/src/a4efaec82a5f95e499c1004a2ecb9453d59edc9e/src/main/webapp/index.html?at=default

The checked-in code still uses an older version of Doppio from December. Recently I tried to upgrade, but it did not solve the issue for me. Guess I am still doing something wrong.

Right now I have /jfxrt/classes on the bootclasspath, which points to a folder with all the class files. This works, but because I have to load 2000+ classes before startup, this takes way too long. My hope is, that if I can use /jfxrt/jfxrt.jar instead, it would reduce startup time significantly.

jvilk commented 9 years ago

In the new demo we're working on, we have multiple JAR files on the bootclasspath, and they work:

https://github.com/jvilk/doppio-demo/blob/master/src/js/frontend.ts#L187

Next time you try this out, could you point me to a failing demo that I can look at / debug?

netopyr commented 9 years ago

I was finally able to fix the issue. The problem was, that I mounted /tmp to an InMemory-Backend and set the extractionPath to /tmp. Setting the extractionPath to /jars, which I do not mount, fixed the issue.

Thanks for the help!

jvilk commented 9 years ago

Awesome! Let me know if you have any other issues.