SwingJS: EJS Java to JavaScript Conversion Examples
written by
Wolfgang Christian and Robert Hanson
It was believed that the entire enterprise that had grown around embedding Java simulations in web pages had come to an end when the Java applet plugin was removed from browsers in 2018. Fortunately, work done at St. Olaf College now makes it possible to convert (transpile) Java programs (both stand alone programs and applets) to JavaScript. Here we present examples of how this technology can be used to convert Java code generated by the Easy Java Simulations modeling and authoring tool.
The examples presented here were not recoded in JavaScript. The simulation's Java code is created using EJS and copied into the Eclipse Java development workspace where it is transpiled into JavaScript. In the end, the original functional of the Java program is virtually identical to its JavaScript counterpart, with all the layout, events, and functionality of the original.
The SwingJS transpiler developers maintain a GitHub repository for Java developers who want to convert their Java applets or Java applications to JavaScript, allowing continued, simultaneous one-source development of both Java and JavaScript.
<a href="https://www.compadre.org/OSP/items/detail.cfm?ID=15444">Christian, Wolfgang, and Robert Hanson. "SwingJS: EJS Java to JavaScript Conversion Examples."</a>
W. Christian and R. Hanson, Computer Program SWINGJS: EJS JAVA TO JAVASCRIPT CONVERSION EXAMPLES (2020), WWW Document, (https://www.compadre.org/Repository/document/ServeFile.cfm?ID=15444&DocID=5292).
W. Christian and R. Hanson, Computer Program SWINGJS: EJS JAVA TO JAVASCRIPT CONVERSION EXAMPLES (2020), <https://www.compadre.org/Repository/document/ServeFile.cfm?ID=15444&DocID=5292>.
Christian, W., & Hanson, R. (2020). SwingJS: EJS Java to JavaScript Conversion Examples [Computer software]. Retrieved September 8, 2024, from https://www.compadre.org/Repository/document/ServeFile.cfm?ID=15444&DocID=5292
Christian, Wolfgang, and Robert Hanson. "SwingJS: EJS Java to JavaScript Conversion Examples." https://www.compadre.org/Repository/document/ServeFile.cfm?ID=15444&DocID=5292 (accessed 8 September 2024).
@misc{
Author = "Wolfgang Christian and Robert Hanson",
Title = {SwingJS: EJS Java to JavaScript Conversion Examples},
Month = {August},
Year = {2020}
}
%A Wolfgang Christian %A Robert Hanson %T SwingJS: EJS Java to JavaScript Conversion Examples %D August 10, 2020 %U https://www.compadre.org/Repository/document/ServeFile.cfm?ID=15444&DocID=5292 %O text/html
%0 Computer Program %A Christian, Wolfgang %A Hanson, Robert %D August 10, 2020 %T SwingJS: EJS Java to JavaScript Conversion Examples %8 August 10, 2020 %U https://www.compadre.org/Repository/document/ServeFile.cfm?ID=15444&DocID=5292
Disclaimer: ComPADRE offers citation styles as a guide only. We cannot offer interpretations about citations as this is an automated procedure. Please refer to the style manuals in the Citation Source Information area for clarifications.
The Easy Java Simulations Modeling and Authoring Tool is needed to explore the computational model used in the SwingJS: EJS Java to JavaScript Conversion Examples.