Skip to content

Commit

Permalink
suggested changes applied
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielaReyna committed Sep 28, 2023
1 parent af325fb commit f7275fc
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 22 deletions.
5 changes: 4 additions & 1 deletion src/content/docs/cheerp/guides/cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@ CMake projects can be compiled with Cheerp by passing a single additional comman
A CMake toolchain file is provided at `$CHEERP/share/cmake/Modules/CheerpToolchain.cmake`, where the `CHEERP` environment variable is set to the path of your Cheerp installation.

For example:

- On Linux: `export CHEERP=/opt/cheerp`
- On macOS: `export CHEERP=/Applications/cheerp`
- On Windows: `set CHEERP=C:\cheerp`

Then pass the toolchain file when configuring the project.

```bash
cmake -DCMAKE_TOOLCHAIN_FILE=$CHEERP/share/cmake/Modules/CheerpToolchain.cmake .
```

## Compiling to WebAssembly

To compile with `-target cheerp-wasm`, use `CheerpWasmToolchain.cmake`.
To compile with `-target cheerp-wasm`, use `CheerpWasmToolchain.cmake`.

```bash
cmake -DCMAKE_TOOLCHAIN_FILE=$CHEERP/share/cmake/Modules/CheerpWasmToolchain.cmake .
```
Expand Down
16 changes: 8 additions & 8 deletions src/content/docs/cheerpj2/03-getting-started/00-Java-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mkdir directory_name

Let's create a basic HTML file like the following example. Please notice the CheerpJ runtime environment has been integrated and initialized. In this example we are assuming your HTML file and your `.jar` files are under the project directory you just created.

```html title="index.html" {6, 9-16}
```html title="index.html" {6, 10-12}
<!doctype html>
<html lang="en">
<head>
Expand All @@ -38,19 +38,19 @@ Let's create a basic HTML file like the following example. Please notice the Che
<script>
cheerpjInit();
cheerpjCreateDisplay(800, 600);
cheerpjRunMain(
"ChangeThisToYourClassName",
"/app/my_application_archive.jar:/app/my_dependency_archive.jar",
);
cheerpjRunJar("/app/my_application_archive.jar");
</script>
</body>
</html>
```

Alternatively, if your application is designed to be executed with the command `java -jar` you can replace `cheerpjRunMain()` for the following line:
Alternatively, if your application is not designed to be executed with the command `java -jar` you can replace `cheerpjRunJar()` for `cheerpjRunMain()` and pass your qualified class name as an argument. For example:

```js
cheerpjRunJar("/app/my_application_archive.jar");
cheerpjRunMain(
"com.application.MyClassName",
"/app/my_application_archive.jar:/app/my_dependency_archive.jar",
);
```

## 3. Host your page
Expand All @@ -62,7 +62,7 @@ npm install http-server
http-server -p 8080
```

> To test CheerpJ you _must_ use a local web server. Opening the `.html` page directly from the disk (for example, by double-clicking on it) is **_not supported_**. This is a very common mistake for first time users.
> To test CheerpJ you must use a web server. Opening the `.html` page directly from the disk (for example, by double-clicking on it) is not supported.
## What's going on?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ CheerpJ can run Java applets in the browser seamlessly. This page will help you

**There are two different ways to run a Java Applet in the browser:**

- Running your own Java applet using the CheerpJ runtime environment and the `<cheerpj-applet>` tag in your own webpage.
- Running a public applet using the [CheerpJ Applet Runner](https://chrome.google.com/webstore/detail/cheerpj-applet-runner-bet/) Chrome extension for applets integrated with the applet tag `<applet>` on public websites.
- [Running your own Java applet](/cheerpj2/getting-started/Java-applet#running-your-own-applet) using the CheerpJ runtime environment and the `<cheerpj-applet>` tag in your own webpage.
- [Running a public applet](/cheerpj2/getting-started/Java-applet#running-a-public-applet) using the [CheerpJ Applet Runner](https://chrome.google.com/webstore/detail/cheerpj-applet-runner-bet/) Chrome extension for applets integrated with the applet tag `<applet>` on public websites.

## Running your own applet

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ cheerpjfy.py --stub-natives=native/ some.jar

> **Note**: Existing files in the passed directory will be overwritten.
| macro | Description |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `CHEERPJ_COMPRESS` | Encode the argument in parenthesis following such scheme. |
| `CHEERPJ_SET_CLASS` | Set the current internal class for resolving fields when using `CHEERPJ_FIELD` and `CHEERPJ_STATIC_FIELD` macros. |
| `CHEERPJ_FIELD` | The compiler replaces this macro with the encoded field name, it assumes the current class has been set by `CHEERPJ_SET_CLASS`. |
CheerpJ uses a compression scheme to encode mangled signatures. The `CHEERPJ_COMPRESS` macro is used automatically by this command, but can also be used manually.

| macro | Description |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| `CHEERPJ_COMPRESS` | Encode the argument in parenthesis following such scheme. |
| `CHEERPJ_SET_CLASS` | Set the current internal class for resolving fields when using `CHEERPJ_FIELD` and `CHEERPJ_STATIC_FIELD` macros. |
| `CHEERPJ_FIELD` and `CHEERPJ_STATIC_FIELD` | The compiler replaces this macro with the encoded field name, it assumes the current class has been set by `CHEERPJ_SET_CLASS`. |

### `--pack-classes-list=PACKCLASSESLIST`

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/cheerpj2/05-reference/Runtime-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ cheerpjInit({

#### `enablePreciseAppletArchives`

Boolean option which enables a special applet classloader.
Boolean option which makes the classloader behavior similar to the native Java plugin. For better performance it is recommended to upgrade to CheerpJ 3.

Example:

Expand Down
10 changes: 5 additions & 5 deletions src/content/docs/cheerpj2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ Know what you're building? Jump straight to the relevant tutorial:

**CheerpJ is constituted of three components:**

1. The CheerpJ AOT compiler, an LLVM-based Java-bytecode to JavaScript compiler. This can be used to convert Java archives (e.g. .jar) or single .class files to JavaScript. The CheerpJ AOT compiler is available for Linux, macOS and Windows.
2. The CheerpJ runtime library, a full Java SE runtime in WebAssembly and JavaScript, that can be distributed in part or in full with applications converted with CheerpJ.
3. The CheerpJ on-the-fly Java-to-JavaScript compiler, a reduced JavaScript version of the CheerpJ compiler that can be distributed with applications converted with CheerpJ to enable dynamic features of Java such as reflection.
1. The CheerpJ AOT compiler, an LLVM-based Java-bytecode to JavaScript compiler. The CheerpJ AOT compiler is available for Linux, macOS and Windows.
2. The CheerpJ runtime library, a full Java SE runtime in WebAssembly and JavaScript. The CheerpJ runtime is cloud-hosted and accessed by the community free of charge for non-commercial purposes only. For self-hosting and commercial please visit our [licensing page](https://cheerpj.com/licensing/).
3. The CheerpJ on-the-fly Java-to-JavaScript compiler, a reduced JavaScript version of the CheerpJ compiler that can be distributed with applications compiled with CheerpJ to enable dynamic features of Java such as reflection.

## What is unique about CheerpJ?

1. CheerpJ can handle 100% of Java 8 including reflection and proxy class creation, with no manual intervention on the code.
1. CheerpJ can handle 100% of Java 8, including Swing, reflection and dynamic class loading with no manual intervention on the code.
2. CheerpJ works directly on Java bytecode, and does not require access to the Java source code.
3. CheerpJ comes with a full Java SE runtime, inclusive of Swing/AWT. It supports audio, printing, and any other Java SE component. The runtime supports WebAssembly for optimal performance and size.
3. CheerpJ comes with a full Java SE runtime, inclusive of Swing/AWT. It supports audio, printing, and any other Java SE features. The runtime supports WebAssembly for optimal performance and size.
4. The JavaScript code generated by CheerpJ is highly optimised and garbage-collectible.
5. CheerpJ enables bidirectional Java-JavaScript interoperability. JavaScript libraries, as well as the DOM, can be called and manipulated from Java. Converted Java modules can be invoked from JavaScript.
6. CheerpJ supports Java multi-threading. In addition, it allows to create concurrent applications by using WebWorkers.
Expand Down

0 comments on commit f7275fc

Please sign in to comment.