I can do something like this in Haskell:
#!/usr/bin/runghc
main=putStrLn "Hello World"
Then I can run it with ./hello.hs
My question is, why is the first line ignored? Comments in haskell start with --
but the first line still seems to be ignored. It even loads in ghci. The trick also works with Python and Perl.
But when I do something similar in Java:
#!/usr/local/jdk1.6.0_13/bin/javac
...
Javac gives me a compiler error.
So how does this work and how would I get it to work with Java?
Thanks.