Skip to content

Commit

Permalink
rephrased 'converted' to 'compiled'
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielaReyna committed Oct 4, 2023
1 parent cc7b701 commit 27d1b59
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
12 changes: 6 additions & 6 deletions src/content/docs/cheerpj3/00-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ title: FAQ

## What is CheerpJ?

CheerpJ is a solution for converting unmodified Java client applications into browser-based HTML5/JavaScript web applications. CheerpJ consists of a full Java runtime environment in JavaScript, and of a on-the-fly compiler for dynamic class generation, to be deployed alongside the application.
CheerpJ is a solution for running unmodified Java client applications into browser-based HTML5/JavaScript web applications. CheerpJ consists of a full Java runtime environment in JavaScript, and of a on-the-fly compiler for dynamic class generation, to be deployed alongside the application.

## What parts of the Java SE runtime are supported?

The CheerpJ runtime environment is a full Java SE runtime in JavaScript. Differently from other technologies which provide a partial re-implementation written manually in JavaScript, we opted to convert the entire OpenJDK Java SE runtime to JavaScript using CheerpJ. The CheerpJ runtime is constituted of both JavaScript files and .jar archives. All CheerpJ runtime components are dynamically downloaded on demand by the application to minimise total download size. The CheerpJ runtime library is hosted by us on a dedicated CDN-backed domain, and we invite users to link to it in order to take advantage of caching and cross-application resource sharing.
The CheerpJ runtime environment is a full Java SE runtime in JavaScript. Differently from other technologies which provide a partial re-implementation written manually in JavaScript, we opted to replace the entire OpenJDK Java SE runtime to JavaScript and WebAssembly. The CheerpJ runtime is constituted of both JavaScript files and .jar archives. All CheerpJ runtime components are dynamically downloaded on demand by the application to minimise total download size. The CheerpJ runtime library is hosted by us on a dedicated CDN-backed domain, and we invite users to link to it in order to take advantage of caching and cross-application resource sharing.

## Can I self-host the CheerpJ runtime?

Please [contact us](https://cheerpj.com/contact/) to discuss self-hosting CheerpJ and its runtime on your infrastructure.

## Can I use CheerpJ to convert my legacy Java application? I have no longer access to the source code.
## Can I use CheerpJ to run my legacy Java application in the browser? I have no longer access to the source code.

Yes, you can convert any Java SE application with CheerpJ without touching the source code. You only need all the .jar archives of your application.
Yes, you can run any Java SE application with CheerpJ without touching the source code. You only need all the .jar archives of your application.

## Can I use CheerpJ to convert Java libraries and integrate them in my HTML5 application?
## Can I use Java libraries and integrate them in my HTML5 application using CheerpJ?

Yes. Java methods can be exposed to JavaScript with an asynchronous interface. A synchronous-looking construct is provided to minimise verbosity when multiple methods are invoked.

Expand Down Expand Up @@ -49,7 +49,7 @@ Many first time users get stuck at this point. The most common issues are:
- Opening the HTML page directly from disk: The URL in the browser should always start with http:// or https://, if it starts with file:// CheerpJ will not work. You need to use a local web server during testing.
- Forgetting to add "/app/" prefix to the JAR files used in Web page. CheerpJ implements a virtual filesystem with multiple mount points, the "/app/" prefix is required.
- More in general, you can use the "Network tab" of the developer tools in the browser to check if the JAR is being correctly downloaded. If the JAR is never downloaded, or a 404 error is returned, something is wrong with the JAR path. If you don't see anything in the "Network tab", please reload the page while keeping the developer tools open.
- When converting obfuscated JARs on MacOS and Windows there might be collisions between classes due to the case-insensitive nature of the filesystem. For example `a.class` and `A.class` will be considered the same. Always try to convert the JAR using a Linux machine before reporting a bug when converting obfuscated JARs.
- When executing obfuscated JARs on MacOS and Windows there might be collisions between classes due to the case-insensitive nature of the filesystem. For example `a.class` and `A.class` will be considered the same. Always try to run the JAR using a Linux machine before reporting a bug when executing obfuscated JARs.

## My application compiled with CheerpJ does not work and I see a cross origin error to a Google service in the console. What's going on?

Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/cheerpj3/01-demos.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This specific applet is a visualization tool for protein structures.

<img src="/cheerpj2/assets/demo_swing.png" width="400">

A few selected Java Swing examples to demonstrate how complex Swing GUI apps can be automatically converted to HTML5/JavaScript.
A few selected Java Swing examples to demonstrate how complex Swing GUI apps can be automatically compiled to HTML5/JavaScript.

- Go to the [demo](https://cheerpjdemos.leaningtech.com/SwingDemo.html)
- [Source](https://docs.oracle.com/javase/tutorial/uiswing/examples/components/index.html)
Expand All @@ -36,7 +36,7 @@ A playground to compile and run Java programs directly in the browser. Both cons

<img src="/cheerpj2/assets/demo_itext.png" width="400">

Edit PDFs fully client side using the industry standard [iText](https://itextpdf.com/en) library converted to JavaScript. This demo demonstrates how CheerpJ APIs can be used to instance Java objects and call methods directly from JavaScript.
Edit PDFs fully client side using the industry standard [iText](https://itextpdf.com/en) library compiled to JavaScript. This demo demonstrates how CheerpJ APIs can be used to instance Java objects and call methods directly from JavaScript.

- Go to the [demo](https://cheerpjdemos.leaningtech.com/iTextDemo.html)
- [Source](https://cheerpjdemos.leaningtech.com/itextCheerpJDemo.js)
2 changes: 1 addition & 1 deletion src/content/docs/cheerpj3/04-guides/File-System-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: File System support
---

CheerpJ provides full filesystem support for converted Java applications.
CheerpJ provides full filesystem support for Java applications running with CheerpJ.

Read only and read/write filesystems are exposed in Java and can be used to read, write and manipulate files as normally when running on a JVM.

Expand Down
16 changes: 7 additions & 9 deletions src/content/docs/cheerpj3/04-guides/Startup-time-optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Startup time optimization
---

This page is a collection of different steps to reduce the startup time of a Java application converted with CheerpJ.
This page is a collection of different steps to reduce the startup time of a Java application compiled with CheerpJ.

## Overview

Traditionally, users had to have Java preinstalled on their computer in order to run Java applications and applets. CheerpJ converts Java to HTML5/JavaScript, allowing to run applications and applets on browser without users having to install any additional dependency on their computer. Similarly to their JVM counterparts, applications converted to JavaScript with CheerpJ require runtime components to be loaded during execution. In CheerpJ, runtime components are JavaScript modules that are loaded on demand, only if required.
Traditionally, users had to have Java preinstalled on their computer in order to run Java applications and applets. CheerpJ compiles Java to HTML5/JavaScript, allowing to run applications and applets on browser without users having to install any additional dependency on their computer. Similarly to their JVM counterparts, applications compiled to JavaScript with CheerpJ require runtime components to be loaded during execution. In CheerpJ, runtime components are JavaScript modules that are loaded on demand, only if required.

The CheerpJ runtime is highly optimised to minimise the total download size of an 'average' application, totalling 10-20MB of data for a typical download (as a point of comparison, the approximate size of the Java runtime installer is over 60MB). All downloaded components of CheerpJ are cached by the browser, which reduces the download time in subsequent executions of a same application.

Expand All @@ -31,12 +31,10 @@ cheerpjInit({ enableProguardTrace: true });
When initialized with this option CheerpJ will keep track of the classes used at runtime, including classes which are accessed via reflection. Follow these steps to safely optimize an application using ProGuard.

1. Build a single `uber-JAR` by merging the application and dependencies
2. Convert the new JAR to JS using `cheerpjfy.py`
3. Run the application using CheerpJ with the `enableProguardTrace:true` option
4. Fully test the application, making sure that all possible scenarios are executed and all needed classes are loaded
5. From the browser console call `cjGetProguardConfiguration()`, a ProGuard configuration file (`cheerpj.pro`) will be automatically generated and downloaded
6. Run `proguard` on the `uber-JAR` using the generated configuration file to generate a smaller JAR with only the needed classes. `proguard -dontwarn -injars uber.jar -outjars uber-stripped.jar -libraryjars ~/cheerpj_1.2/rt.jar @cheerpj.pro`
7. Convert this new JAR using `cheerpjfy.py`
2. Run the application using CheerpJ with the `enableProguardTrace:true` option
3. Fully test the application, making sure that all possible scenarios are executed and all needed classes are loaded
4. From the browser console call `cjGetProguardConfiguration()`, a ProGuard configuration file (`cheerpj.pro`) will be automatically generated and downloaded
5. Run `proguard` on the `uber-JAR` using the generated configuration file to generate a smaller JAR with only the needed classes. `proguard -dontwarn -injars uber.jar -outjars uber-stripped.jar -libraryjars ~/cheerpj_1.2/rt.jar @cheerpj.pro`

## Preload resources

Expand All @@ -46,7 +44,7 @@ To take advantage of parallel downloads, and reduce download and startup time of

This list of resources is to be specified manually when starting the CheerpJ environment in an HTML page. We also provide a simple profiling tool to automatically record and output a list of used resources during the execution of an application.

By combining the use of this profiler together with the preloader, one can highly optimise the initial download and startup time of a converted application. Taking advantage of this is a simple 2-step process:
By combining the use of this profiler together with the preloader, one can highly optimise the initial download and startup time of an application. Taking advantage of this is a simple 2-step process:

1. Run the application normally using CheerpJ. After the application is loaded, open the JavaScript console of the browser (e.g. Ctrl+Shift+I on many browsers), and type:

Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/cheerpj3/05-reference/Runtime-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Runtime API
---

CheerpJ exposes a simple JavaScript API to interact with a Java application converted to JavaScript. This API can be use to initialise CheerpJ, invoke Java methods, convert data and to enable/disable certain debugging features.
CheerpJ exposes a simple JavaScript API to interact with a Java application compiled to JavaScript. This API can be use to initialise CheerpJ, invoke Java methods, convert data and to enable/disable certain debugging features.

## Runtime initialization

Expand Down Expand Up @@ -142,7 +142,7 @@ cheerpjInit({ logCanvasUpdates: true });

Some applications needs to internally handle keyboard shortcuts which are also used by the browser, for example Ctrl+F. Most users expect the standard browser behavior for these shortcuts and CheerpJ does not, by default, override them in any way.

A CheerpJ-converted application can take control of additional shortcuts by providing a callback function as the `overrideShortcuts` options of `cheerpjInit`. This callback receives the `KeyboardEvent` coming from the browser and should return `true` if the default browser behaviour should be prevented.
A CheerpJ-compiled application can take control of additional shortcuts by providing a callback function as the `overrideShortcuts` options of `cheerpjInit`. This callback receives the `KeyboardEvent` coming from the browser and should return `true` if the default browser behaviour should be prevented.

Whenever possible we recommend _not_ to use browser reserved shortcuts, to maintain a consistent user experience. In any case, the following limitations apply:

Expand Down

0 comments on commit 27d1b59

Please sign in to comment.