The only good kind of Javascript is a Java Script

by

I just spent a bit too long trying to figure out how to script my Java scripts. I wanted to go as far as giving them a shebang line, but if I created a file called hello.java and put the following in

#!/usr/bin/env -S java --source 25
void main(){ 
 IO.println("hi");
}

it would complain about not being able to find a class. which is irksome. it should be able to find a class. the implicit class. it's a feature in java. but it doesn't.

however, if you rename the file to something without .java, everything works flawlessly. I named it just script, then

> chmod a+x script 

then

./script 

and it worked!

i hope this helps someone else write effective java scripts. it's really nice being able to write java scripts. (with threads, no less!)

More posts

Comments powered by Talkyard.