Skip to content

Commit 9df3719

Browse files
Copilotnvuillam
andcommitted
Update README with windowsHide documentation and examples
Co-authored-by: nvuillam <17500430+nvuillam@users.noreply.github.com>
1 parent 77559df commit 9df3719

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Example: `["-Xms256m", "--someflagwithvalue myVal", "-c"]`
7272
| javaArgs | List of arguments for JVM only, not the JAR or the class | `[]` | `['--add-opens=java.base/java.lang=ALL-UNNAMED']` |
7373
| [windowsVerbatimArguments](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) | No quoting or escaping of arguments is done on Windows. Ignored on Unix. This is set to true automatically when shell is specified and is CMD. | `true` | `false` |
7474
| [windowless](https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html#:~:text=main()%20method.-,javaw,information%20if%20a%20launch%20fails.) | If windowless is true, JavaCaller calls javaw instead of java to not create any windows, useful when using detached on Windows. Ignored on Unix. | false | true
75+
| [windowsHide](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) | On Windows, hide the subprocess console window that would normally be created. Set to `false` if you need Java UI dialogs to be visible (e.g., print dialogs). Ignored on Unix. | `true` | `false`
7576
| [timeout](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) | In milliseconds the maximum amount of time the process is allowed to run. | `undefined` | `1000`
7677
| [killSignal](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) | The signal value to be used when the spawned process will be killed by timeout or abort signal. | `SIGTERM` | `SIGINT`
7778

@@ -149,6 +150,23 @@ const java = new JavaCaller({
149150
const { status, stdout, stderr } = await java.run(['--sleep'], { windowless: true });
150151
```
151152

153+
Call java process with visible windows (e.g., for print dialogs)
154+
155+
```javascript
156+
const java = new JavaCaller({
157+
classPath: 'test/java/dist',
158+
mainClass: 'com.nvuillam.javacaller.JavaCallerTester'
159+
});
160+
// Set windowsHide to false to allow Java UI dialogs to be visible
161+
const { status, stdout, stderr } = await java.run([], { windowsHide: false });
162+
```
163+
164+
When using CLI mode with `--no-windows-hide` flag:
165+
166+
```bash
167+
node index.js --no-windows-hide
168+
```
169+
152170
You can see **more examples in** [**test methods**](https://github.com/nvuillam/node-java-caller/blob/master/test/java-caller.test.js)
153171

154172
## TROUBLESHOOTING

0 commit comments

Comments
 (0)