精華區beta java 關於我們 聯絡資訊
http://www.javaworld.com.tw/jute/post/view?bid=45&id=192809&sty=1&tpg=1&age=0 When i was student, i learn java and write the famous program "Hello World", I think that is the fast way to learn the syntax. Many people use alert or document.write to print the javascript message, but you must to learn some html, if you only want to learn javascript core api, maybe you can try write a "Hello World" javascript program, we can use Rhino to do this. Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users. there are some steps to do step1 : download Rhino : ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_6R5.zip step2 : put the js.jar into the CLASSPATH, you can put it into JRE library ext folder step3 : exec the command: java org.mozilla.javascript.tools.shell.Main this command will invoke the Rhino interactive shell step4 : exec the command: js> java.lang.System.out.println("Hello World!!") the console will show the Hello World message step5 : exit the interactive shell: js> quit() you also can write the .js file and use the options java org.mozilla.javascript.tools.shell.Main -f youfilename.js see also the Rhino document http://www.mozilla.org/rhino/doc.html -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.192.149.36