You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sites/cheerpj/src/content/docs/10-getting-started/00-Java-app.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Run a Java application
2
+
title: Run a Java Application
3
3
description: Convert a desktop app to a webapp
4
4
---
5
5
@@ -10,12 +10,12 @@ Java source code is not needed to use CheerpJ. If you are building your own appl
10
10
**To get started you will need:**
11
11
12
12
- Your Java application file(s). You can also use this [TextDemo.jar](https://docs.oracle.com/javase/tutorialJWS/samples/uiswing/TextDemoProject/TextDemo.jar) sample.
13
-
- An HTML file where your Java app will be wrapped
14
-
- A simple HTTP server to test your webpage locally
13
+
- An HTML file where your Java app will be wrapped.
14
+
- A simple HTTP server to test your webpage locally.
15
15
16
16
## 1. Create a project directory
17
17
18
-
Let's start by creating a project folder where all your files will be. Please copy your java and future HTML files here.
18
+
Let's start by creating a project folder where all your files will be. Copy your java and future HTML files here.
19
19
20
20
```shell
21
21
@@ -32,7 +32,7 @@ Let's create a basic HTML file like the following example. Please notice the Che
> It is common for first-time users to forget to add the prefix “/app/” when passing the application location to cheerpJRunJar() or cheerpjRunMain().
61
61
62
62
## 3. Host your page
@@ -67,9 +67,13 @@ You can now serve this web page on a simple HTTP server, such as the http-server
67
67
npx http-server -p 8080
68
68
```
69
69
70
-
> [!tip]
70
+
> [!note] Info
71
71
> Opening the page directly from the disk (for example, by double-clicking on it) is not supported.
72
72
73
+
## The result
74
+
75
+
You will see the CheerpJ display on your browser with some loading messages before showing your application running. Depending on your application and the optimizations applied, this could take just a few seconds.
76
+
73
77
## What's going on?
74
78
75
79
- The `<head>` script loads CheerpJ.
@@ -78,13 +82,9 @@ npx http-server -p 8080
78
82
-[`cheerpjRunJar`] executes your application!
79
83
-`/app/` is a [virtual filesystem] mount point that references the root of the web server this page is loaded from.
80
84
81
-
## The result
82
-
83
-
You will see the CheerpJ display on your browser with some loading messages before showing your application running. Depending on your application and the optimizations applied, this could take just a few seconds.
84
-
85
85
### Is your application not working?
86
86
87
-
Please try these checks:
87
+
If your application doesn't work, check the following:
88
88
89
89
- The location of your JARs is correct and the prefix `/app/` is added when passing it to [`cheerpjRunJar`] or [`cheerpjRunMain`]. For more information visit the [virtual filesystem] guide.
90
90
- Your Java application works normally on your machine without CheerpJ.
Copy file name to clipboardExpand all lines: sites/cheerpj/src/content/docs/10-getting-started/02-Java-library.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Run a Java library
2
+
title: Run a Java Library
3
3
description: Use Java classes in JavaScript
4
4
---
5
5
@@ -13,15 +13,15 @@ Java source code is not required to use CheerpJ. If you are using your own libra
13
13
- An HTML file where your Java app will be wrapped.
14
14
- A simple HTTP server to test your webpage locally.
15
15
16
-
## 1. Create a Project Directory
16
+
## 1. Create a project directory
17
17
18
18
Let's start by creating a project folder where all your files will be. Copy your java and future HTML files here.
19
19
20
20
```shell
21
21
mkdir directory_name
22
22
```
23
23
24
-
## 2. Create a Basic HTML File
24
+
## 2. Create a basic HTML file
25
25
26
26
Let's create a basic HTML file and include and initialize CheerpJ on your page. The `cheerpjInit` command initialises the CheerpJ runtime environment.
27
27
@@ -41,7 +41,7 @@ Let's create a basic HTML file and include and initialize CheerpJ on your page.
41
41
</html>
42
42
```
43
43
44
-
## 3. Load and Call the Java Library From Java
44
+
## 3. Load and call the Java library from JavaScript
45
45
46
46
Now we can load your Java library by calling `cheerpjRunLibrary` which will load the library from the root of your web server. We are assuming your HTML file and your `.jar` files are under the project directory you just created.
47
47
@@ -50,7 +50,7 @@ Now we can load your Java library by calling `cheerpjRunLibrary` which will load
@@ -66,15 +66,15 @@ Now we can load your Java library by calling `cheerpjRunLibrary` which will load
66
66
</html>
67
67
```
68
68
69
-
## 3. Host your page
69
+
## 4. Host your page
70
70
71
71
You can now serve this web page on a simple HTTP server, such as the http-server utility.
72
72
73
73
```shell
74
74
npx http-server -p 8080
75
75
```
76
76
77
-
## The Result
77
+
## The result
78
78
79
79
You will see CheerpJ initialize in your browser and load the Java library. Once loaded, the methods from your library can be called directly from JavaScript, just as in the example above. Depending on the size of your library and the optimizations applied, this may take just a few seconds before your code begins executing.
0 commit comments