Originally published on: Sat, 24 Jul 2010
After successfully compilng a Rhino JavaScript program to a Java class file ( Compiling Rhino JavaScript to Java), I wanted to see if I could then convert such a class file to a Windows executable (EXE) file using launch4j.
Let's start by creating a new, self-contained JS file that does not contain any runtime calls to load().
The script dir_scan.js uses a recursive function scanDir() to traverse a directory, tallying up all of the consumed file space into a map named mapOfDirs.
After the traversal, the keys from mapOfDirs are isolated into an array called mapKeys. The array is then sorted. A closure function is used in the sort invocation that sorts the array based on the corresponding value in the map. When the call to mapKeys.sort() completes, the array then holds the keys in sorted, ascending order by the computed filesize of the elements of the given directory.
dir_scan.js
| Previous post: | Compiling Rhino JavaScript to Java |
|---|---|
| Next post: | Extending SpiderMonkey JavaScript on Windows |
Click **here**
A JavaScript REPL for Android Devices
A Review of Kevin Mitnick's Book Ghost in the Wires
Play MP3 Files with Python on Windows
Scott Ballantyne: Blazin' Into Forth
An Interview with Tom Zimmer: Forth System Developer
PHP, Transparent GIF's, and Web Tracking
A Review of Kevin Mitnick's Book Ghost in the Wires
Book Review : Using Google App Engine
Choose your own Adventure with Sinatra
Invoking the Default Windows Screen-Saver
Why Some Web Sites will go Dark on Jan 18th
Book Review : Paull Allen - Idea Man
A 90's Experiment in Online Systems - The U.S. West CommunityLink Service