to compile .coffee into .js and consume in Eclipse
-
with
coffeeglobal executablenpm install -g coffee-script
coffee -c coffee.coffee -
node bin\coffee -
with node (peep into bin/coffee -> require(lib + '/coffee-script/command').run();)
node lib\coffee-script\command.js -c coffee.coffeefails, no out put -
Java java -classpath path/to/rhino/js.jar:path/to/closure/compiler.jar org.mozilla.javascript.tools.shell.Main r.js main.js
java -classpath rhino-1.7R4.jar org.mozilla.javascript.tools.shell.Main r.js main.js
http://www.coderanch.com/t/549722/java/java/Calling-Javascript-function-Java-Code
5 things you didn't know about ... the Java Scripting API
Note: Could not run jrunscript on JDK 6, but ok in JDK 7.
http://stackoverflow.com/questions/9119137/run-node-js-from-java-or-groovy
Executing Java from the command line
compile java -cp . App.java
run java -cp . App println.js
jrunscript println.js
http://requirejs.org/docs/node.html
Yes Node does. That loader uses the CommonJS module format. The CommonJS module format is non-optimal for the browser, and I do not agree with some of the trade-offs made in the CommonJS module format. By using RequireJS on the server, you can use one format for all your modules, whether they are running server side or in the browser. That way you can preserve the speed benefits and easy debugging you get with RequireJS in the browser, and not have to worry about extra translation costs for moving between two formats.
TODO
http://stackoverflow.com/questions/11074836/resolving-modules-using-require-js-and-java-rhino
- You have to make sure to use [r.js][1] (not require.js) , modified version of require.js for rhino.
- You have to extend
ScritableObjectclass to implementloadandprintfunction. When you callrequire(["a"]), the load function in this class will be called, you can tweak this function to load the js file from any location. In the below example, I load fromclasspath. - You have to define the property
argumentsin the sharedscope as shown below in the sample code - Optionally, you can configure the sub path using
require.config, to specify the subdirectory inside classpath where js files are located.
For information on its use, as well as how to get the JAR files to run it under Rhino, see the r.js README https://github.com/jrburke/r.js