Developing JalviewJS

JalviewJS is built from Jalview’s Java source using a Java to JavaScript transpiler called java2script. The .js files that are produced rely on a JavaScript package called SwingJS, which is a transpiled version of Java’s virtual machine platform. SwingJS interfaces with the Browser to to enable graphics, sound, video and user interface components to be created and displayed.

History of the project

JalviewJS has been made possible through a collaboration with Robert Hanson. Bob is the author of Jmol and creator of JmolJS (the JavaScript port of Jmol). Bob created a proof-of-concept in 2015 by applying the Eclipse Java2Script Transpiler to a modified version of Jalview’s JalviewLite applet. After this, the SwingJS was created. Since July 2018, Bob, Mungo Carstairs, and the rest of the Jalview team have been working on adapting specific aspects of Jalview’s code base. Bob has also been working to port additional Java runtime components to SwingJS, taking advantage of capabilites built in to the Browser’s javascript environment such as support for JSON and XML.

Building JalviewJS yourself

  1. Read the Getting Started as a Jalview Developer
  2. Download or clone Jalview’s source repository and build it (see build instructions).
  3. Download a zip archive of the Eclipse Java Development distribution for your platform. Unpack it in to a new directory.
  4. Execute Jalview’s gradle build script with the jalview-js target:
gradle -Pjalviewjs_eclipse_root=<_directory where you unpacked Eclipse_> jalviewjs

If JalviewJS was correctly built, you should see files under build/jalview-js/site/ such as jalview_bin_Jalview.html. 5. Spin up a web server in the build/jalview-js/site directory, and test your JalviewJS build in the browser cd build/jalview-js/site python -m http.server Then open http://localhost:8000/jalview_bin_JalviewJS.html to open JalviewJS with an example file.

To keep up with latest developments, please get in contact via the gitter chat or sign up at our issue tracker to follow issues.