adambien.blog

Adam Bien: "hello, world" Java 25 Script In 4 Lines (opens in new tab)

Java 25 source-file mode turns a single file into an executable command. No compilation, no build tool, no .java extension. Here is how to create a zhello script: Create a file named zhello (no extension) with the shebang #!/usr/bin/env -S java --source 25 Add an instance void main() method that calls IO.println("hello, world") Make it executable: chmod +x zhello Install it system-wide: sudo cp zhello /usr/local/bin/ The entire script: #!/usr/bin/env -S java --source 25 void main() { IO.print...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help