Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 04-10-2011, 03:27 PM   #1
hjalfi
Junior Member
hjalfi began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Apr 2011
Device: Kindle 3g
Javascript shell for the Kindle

Hi,

I bought a Kindle a couple of weeks ago. I think I had a jailbreak installed within two hours...

I've got a reasonably decent port of the Rhino Javascript interpreter for the Kindle:

http://www.cowlark.com/kindle/javascript.html

It's living in a custom VT52-ish terminal emulator, and I've done my own keyboard handling and command line editing so I can type proper Javascript expressions on the Kindle's keypad. Rhino's integration with Java makes it really useful for exploring the Java APIs, because I can manipulate Java objects right from the command line.
Alas, the security policies mean that we can't actually get out of the JVM sandbox (including creating our own class loader to make Rhino's JIT work, curses curses), but it's still quite handy.

Don't suppose anyone's figured out how to do custom fonts in a Kindlet? The standard monospace font looks like suck with antialiasing turned off (needed to make it comfortable to type on).

People may be interested to pull it apart; among other things, it's using retroweaver to let me use Java 1.5 constructs on the Kindle.

There's a binary too (which includes installers for my public keys so people can run it).

I've also written up some notes on how to get started with Kindle application development:

http://www.cowlark.com/kindle/getting-started.html

I hope this is useful to someone...
hjalfi is offline   Reply With Quote
Old 03-16-2012, 07:08 PM   #2
shuttle
Junior Member
shuttle began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Mar 2012
Device: Kindle DXG v3.2.1
Nice tool, but it is optimized to Kindle 3 and not to Kindle DX
And it fails by writing message to file. (sample commands)

Code:
  var home = kjs.getHomeDirectory();
  var f = new java.io.File(home, "test.txt");
  var ps = new java.io.PrintStream(f);
  ps.println("Hello, world!");
  ps.close();

Last edited by shuttle; 03-16-2012 at 07:26 PM.
shuttle is offline   Reply With Quote
Old 03-17-2012, 05:31 PM   #3
hjalfi
Junior Member
hjalfi began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Apr 2011
Device: Kindle 3g
That's because the ghastly old dialect of Java that the Kindle supports does support creating PrintStreams directly from Files. You have to create a FileOutputStream first. Try this:

var home = kjs.getHomeDirectory();
var f = new java.io.File(home, "test.txt");
var fos = new java.io.FileOutputStream(f);
var ps = new java.io.PrintStream(fos);

The Kindle only supports PBP 1.1, which is now pathetically old; see the documentation here for the API list:

http://docs.oracle.com/javame/config...217/index.html
hjalfi is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick Kindle 3 root shell via USB ecostin Kindle Developer's Corner 186 02-08-2012 02:11 PM
Accessories Are there any Hard Shell Cases for the Kindle 3? IamtheWalter Amazon Kindle 10 02-10-2011 07:33 PM
Root / Shell / Term / SSH / editor on a Kindle 2? JDShaffer Kindle Developer's Corner 2 12-13-2010 06:11 PM
I need Javascript help Nate the great Workshop 4 04-04-2009 12:55 AM
Hacks can you get a shell on your kindle? svakanda Amazon Kindle 4 02-27-2009 10:37 AM


All times are GMT -4. The time now is 11:51 PM.


MobileRead.com is a privately owned, operated and funded community.