2010年5月13日 星期四

Parsing JSON from external File in Java

JSON is an easy to construct and easy to test format which can be edited in every text editor and test by any web browsers. It is a good option for software developer to consider JSON as a format for storing configuration information.


If you are a Java Development and you wish to use an external file for keeping the configuration of your application, you may consider storing it in JSON. If you don't know what JSON look like you can search a lot of resources form Google. Here I will introduces Rhino as a tools for Java Developers to obtain (parse) the value in JSON format.

The steps in creating Java Class for parsing JSON from external file can be found in the Rhino-Tutorial site.

2010年5月7日 星期五

Creating the jsc command

To compile a JavaScript file into java byte code invoke the following class

org.mozilla.javascript.tools.jsc.Main 

In most of the time, if we want to compile the JavaScript file, we should start a Rhino session in order to invoke the org.mozilla.javascript.tools.jsc.Main class.  This may be trivial if we have to compile a batch of files at a time.  Thus, it's better if we can have a command instead of invoking a jar class file. 

Thus, I've written a  step by step tutorial on how to create a jsc command and how to execute the command in the rhino tutorial website.

Happy programming,

Cloudgen Wong

Welcome to Rhino tutorial

Rhino is Java library and tools for implementing the Javascript's core component. In brief, Rhino provides the followings: 

  1. Javascript Shell,
  2. Javascript compiler for generating Java bytecode,
  3. Javascript debugger and
  4. Java classes for implementing Javascript into Java program.

For Java programmers, Rhino is a useful tools for creating Javascript configuration files.  For Javascript programmers, Rhino is a useful platform for testing or execution of script file or shell code.

Please keep on visit this the rhino tutorial website. Happy programming,

Cloudgen Wong