Skip to content

Commit

Permalink
Removed content regarding enableAppletArchives, disableErrorReporting…
Browse files Browse the repository at this point in the history
…, cheerpjfy, other rephrasings from PR feedback
  • Loading branch information
GabrielaReyna committed Oct 4, 2023
1 parent 27d1b59 commit b2e2c6d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 80 deletions.
9 changes: 2 additions & 7 deletions src/content/docs/cheerpj3/00-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Yes, you can run any Java SE application with CheerpJ without touching the sourc

## 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.
Yes. Java methods can be exposed to JavaScript with an interface compatible with async/await for convenience.

## Can I call JavaScript libraries or web APIs from Java?

Yes, CheerpJ allows you to interoperate with any JavaScript or browser API.
Yes, CheerpJ allows you to interoperate with any JavaScript or browser API. Java native methods implemented in JavaScript are supported.

## Does CheerpJ support reflection?

Expand All @@ -34,10 +34,6 @@ Yes.

Yes.

## When compiling my application I see the message `Failure compiling MyFile.class`, but cheerpjfy continues to execute with no errors

This means that it was not possible to use the new codegen. CheerpJ will use, for this class, the legacy codegen. This might happen for multiple classes in the same .jar,

## When I run CheerpJ I see 404/403 errors in the browser console. What's going on?

Ignore those errors. CheerpJ provides a filesystem implementation on top of HTTP. In this context it is absolutely ok for some files to be missing. CheerpJ will correctly interpret 404 errors as a file not found condition.
Expand All @@ -49,7 +45,6 @@ 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 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
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ http-server -p 8080

### What's going on?

- The `cheerpjInit({enablePreciseAppletArchives:true});` initializes CheerpJ runtime environment indicating we are loading an applet.
- The `cheerpjInit();` initializes CheerpJ runtime environment.
- The `<cheerpj-applet>` tag specifies the code base in a similar manner as the now deprecated `<applet>` tag.

> To avoid potential conflicts with native Java we recommend replacing the original HTML tag with `cheerpj-` prefixed version. You should use `<cheerpj-applet>`, `<cheerpj-object>` or `<cheerpj-embed>` depending on the original tag.
Expand Down
71 changes: 0 additions & 71 deletions src/content/docs/cheerpj3/05-reference/Runtime-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,6 @@ In `system` mode CheerpJ will share the clipboard with the system. Browsers enfo
- `Ctrl+V`/`Cmd+V`: this shortcut behaves normally, there is no difference with native execution.
- Menu based Copy/Paste: `Ctrl+C`/`Ctrl+V` are needed to access the clipboard. CheerpJ will block the execution while waiting the appropriate shortcut.

Commercial users adopting this integration have so far reported that this change in UX is not a significant burden for users. Moreover, in the future we plan to add an additional clipboard mode to take advantage of a new permission-based browser API which is currently being standardized. This future mode will provide native like user experience in all cases.

#### `disableErrorReporting`

CheerpJ automatically reports errors at runtime. Setting this option to `true` disables this system.

Example:

```js
cheerpjInit({ disableErrorReporting: true });
```

#### `disableLoadTimeReporting`

CheerpJ automatically get data about loading time. Setting this option to `true` disables this system.

Example:

```js
cheerpjInit({ disableLoadTimeReporting: true });
```

#### `enableInputMethods`

When this option is set to `true` CheerpJ will be able to receive text input from the input method framework of the platform. This is useful to support text input for languages such as Chinese, Japanese and Korean.
Expand Down Expand Up @@ -202,16 +180,6 @@ cheerpjInit({
});
```

#### `enablePreciseAppletArchives`

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:

```js
cheerpjInit({ enablePreciseAppletArchives: true });
```

## Graphics

### cheerpjCreateDisplay
Expand Down Expand Up @@ -372,45 +340,6 @@ resolvedMethod(arg1, arg2, arg3);

Please note that this convenient form can unfortunately only be used on the main thread, not on Workers. For more information see [WebWorker API](/cheerpj3/reference/WebWorker-API)

## Data conversion

### cjStringJavaToJs

`cjStringJavaToJs(javaString)`

```js
var jsString = cjStringJavaToJs(javaString);
```

This converts a Java string into a JavaScript string. This operation implies a copy.

### cjStringJsToJava

`cjStringJsToJava(jsString)`

```java
String javaString = cjStringJStoJava(jsString);
```

This converts a JavaScript string into a Java string. This operations also implies a copy. String parameters passed to `cheerpjRunMain`, `cjCall` and `cjNew` are automatically converted so it is not necessary to use this methods in that case.

### cjTypedArrayToJava

`cjTypedArrayToJava(array)`

Converts a TypedArray to a Java compatible primitive array. This operation implies a copy. Data is converted as follows:

| Typed Array | Java array |
| ------------ | ---------- |
| Int8Array | byte[] |
| Uint8Array | byte[] |
| Int16Array | short[] |
| Uint16Array | char[] |
| Int32Array | int[] |
| Uint32Array | int[] |
| Float32Array | float[] |
| Float64Array | double[] |

## Preloading

Check failure on line 343 in src/content/docs/cheerpj3/05-reference/Runtime-API.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/cheerpj3/05-reference/Runtime-API.md#L343

[Vale.Terms] Use 'preloading' instead of 'Preloading'.
Raw output
{"message": "[Vale.Terms] Use 'preloading' instead of 'Preloading'.", "location": {"path": "src/content/docs/cheerpj3/05-reference/Runtime-API.md", "range": {"start": {"line": 343, "column": 4}}}, "severity": "ERROR"}

### cjGetRuntimeResources<a name="cjGetRuntimeResources"></a>
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/cheerpj3/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Both are written in C++ and are compiled to WebAssembly & JavaScript using [Chee
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 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.
5. CheerpJ enables bidirectional Java-JavaScript interoperability. JavaScript libraries, as well as the DOM, can be called and manipulated from Java. Also, Java modules can be invoked from JavaScript.
6. CheerpJ supports Java multi-threading. In addition, it allows to create concurrent applications by using WebWorkers.

## Licensing
Expand Down

0 comments on commit b2e2c6d

Please sign in to comment.