It's definitely doable, although the only way I know how to do it at the moment is a two step process...
- Compile the javascript to Java using Mozilla Rhino JSC.
- Compile the resulting java class file to executable using something like GNU's GCJ.
Why would you want to, though? What advantage do you expect to find?