npm.io
0.1.1 • Published 19h agoCLI

@thiagodiogo/psjava

Licence
MIT
Version
0.1.1
Deps
2
Size
10 kB
Vulns
0
Weekly
0

psjava

npm CI license

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.

Install

npm install -g @thiagodiogo/psjava

Requires a JDK 11+ with jshell on your PATH. Verify your setup with psjava doctor.

Usage

psjava example.psjava           # run the file
psjava example.psjava --debug   # run, and print the elapsed time at the end
psjava doctor                   # check that jshell is available

A .psjava file is just Java:

var name = "world";
print("hello, " + name);

The print helper

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.

How it works

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.

License

MIT

Keywords