Run .psjava files as scripts — plain Java on top of JShell, with zero ceremony.
There's no custom syntax and no transpilation: whatever is in the file is exactly what jshell runs. psjava only adds a small print helper to the session and strips the Windows BOM — nothing else touches your code.
npm install -g @thiagodiogo/psjavaRequires a JDK 11+ with jshell on your PATH. Verify your setup with psjava doctor.
psjava example.psjava # run the file
psjava example.psjava --debug # run, and print the elapsed time at the end
psjava doctor # check jshell and the editor syntax highlighting
psjava highlight install # enable .psjava syntax highlighting in your editorsA .psjava file is just Java:
var name = "world";
print("hello, " + name);psjava defines a print(...) in the session before your code runs (still plain Java — your file stays untouched). It comes with overloads for String, int[], and List:
print("text"); // text
print(new int[]{1, 2, 3}); // [1, 2, 3]
print(java.util.List.of("a", "b")); // [a, b]System.out.println(...) keeps working as usual.
Since a .psjava file is plain Java, psjava highlight install just tells your editor to treat *.psjava as Java — no extension or plugin to maintain:
- VSCode — adds
"*.psjava": "java"to your usersettings.json. - IntelliJ — maps
*.psjavato the Java file type infiletypes.xml.
It detects each editor's config folder automatically (Windows) and asks for the path when it can't find one. Reopen the editor afterwards for the highlighting to kick in. psjava doctor reports, per editor, whether the highlighting is already set up.
psjava reads your file, prepends the print overloads, and pipes the result straight into jshell -s. The only change made to your source is removing the Windows BOM, which jshell chokes on. That's it — plain Java into JShell.