Create an executable for a program in an interpreted language: Difference between revisions

J draft
m (→‎{{header|Phix}}: be nice, Pete)
(J draft)
Line 349:
remove( "/tmp/t" );
}</lang>
 
=={{header|J}}==
 
I think this task is a duplicate of another task. But it's also about the host operating system.
 
<lang j>#!/usr/local/bin/jconsole
echo 'hello world'
exit 0</lang>
 
This is a basic example of how to implement a J shell script. This example assumes that J's jconsole was installed at /usr/local/bin/jconsole (note that java also has a jconsole which might be installed in /usr/bin/ -- so on debian and ubuntu which avoid such conflicts but which also do not install to /usr/local/bin the J implementation installs /usr/bin/ijconsole which is what would be needed in the hashbang line. Also, many J installs do not put j executables in a directory in $PATH. So the usual trick of using /usr/bin/env tends to not be useful both because the executable names and locations may vary. Conceptually this means that if you want to distribute a J program you probably need to also distribute a copy of J along with it. Fortunately, J is gpl'd and reasonably small, so that should not be too much of a burden. Also, unix executables must be made executable before they can run...
 
Meanwhile, under Windows, the hashbang line would be ignored, and unnecessary. For windows, there's registry entries tell windows what interpreter to use for a specific extension. So you could eliminate the first line in the above example, but you'd have to do some other work (including picking and using a specific extension).
 
=={{header|Phix}}==
6,951

edits