Author Topic: Nspire Java  (Read 9717 times)

0 Members and 1 Guest are viewing this topic.

Offline azazad

  • LV0 Newcomer (Next: 5)
  • Posts: 1
  • Rating: +0/-0
    • View Profile
Nspire Java
« on: August 18, 2012, 12:44:09 am »
I have seen the other topics on Java for Nspire, and they all seem to be dead. So I will create a new one to keep the idea alive  :)

I hope the following will encourage greater interest in the idea of Java for the Nspire, and possibly lead to this idea becoming a reality. I have had some experience using Java ME for Lego robotics, and I am somewhat surprised that something similar is not available for the Nspire yet. The Nspire is the first TI calculator that can support a JVM with reasonable resources to spare, so why not?


Can the Nspire handle it?

A JVM (Java Virtual Machine) implementation called Lejos has been available for the Lego Mindstorms NXT robotic brick for years already: http://lejos.sourceforge.net/. I will use the Lego NXT as a basis for comparison with the Nspire.

The NXT's specs compared to the original Nspire non-CAS:
NXTNspire
Processor:ARM7 @ 48MHzARM9 eq. @ ~150MHz
RAM:64kB16MB
Flash ROM:256kB20MB

The Lejos project chose to implement Java ME instead of SE for obvious reasons. Java ME is probably the most we can hope for.

Minimum system requirements for Java ME:
RAM:8MB
ROM:5MB
(from http://www.oracle.com/technetwork/java/embedded/resources/me-embeddocs/index.html)

Note that these specs are for Linux. The Nspire's simpler OS should leave even more room to spare. Can the Nspire handle Java ME? I think so.


Is it practical on a time/effort basis?

Sure. The Lejos team did it for a much more limited platform, and did it well. Their implementation has garbage collection, threading, exception handling, synchronization, and many of the other features expected out of Java. Much of the core Lejos JVM and classloader can be reused for the Nspire. The LCD and input classes can be customized for the Nspire's hardware. (Color support on the CX)


Why Java? Isn't Lua enough?

Java's performance will definitely be better, possibly much better:
  • Lua is dynamically typed, while Java is statically typed
  • Lua programs must be parsed into tokens/bytecode before execution, Java programs are precompiled into bytecode ready for execution
  • Nspire Lua interpreter was written by TI (automatic performance hit! :D)

Even without Jazelle or JIT, Java should be fast enough for most purposes.

Lua is more of a scripting language, while Java is more of an application language. Lua is easier for beginners to pick up, while Java is a more efficient language for experienced programmers. Plus, more people should be familiar with Java, since it is more likely to be taught in CS courses and has a more C-like syntax.


There will be no shortage of Java programs that can be ported to the Nspire (excluding you-know-what ;) ). Thousands of MIDlets, or mobile phone apps, can be easily ported. With a suitable compatibility layer, we should even be able to run some applets. Java for the Nspire would unlock massive potential.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Nspire Java
« Reply #1 on: August 18, 2012, 01:06:53 am »
First off, I'm not trying to discourage you. Please don't take it that way :)

A JVM is a VERY difficult task. Even porting one is insanely complicated unless you're extremely comfortable with your language of choice.

Secondly, the Nspire does indeed support Jazelle, last I heard. Jazelle is not a complete hardware JVM though. It is a partial hardware implementation of some of the easier opcodes. It also supports vector tables for the opcodes it's missing, IIRC. The issue is that it's badly documented from what others have mentioned. You may want to check into it, but I wouldn't get my hopes up.

Also, the JVM is itself one of the most complicated pieces of software you will ever have the chance to modify. Understanding the architecture is no mean feat by itself.

TL;DR: Read the Sun spec. I don't care if it's not relevant. Read it. Read "Inside the Java Virtual Machine" as well. Also, spend a few weeks reading through all the ARM documentation on the Nspire's processor (can't remember the precise model number). Also, good luck and take your time. It will be like drinking from a firehose for the first few weeks.

:)

EDIT:

http://ourl.ca/15081/283054
« Last Edit: August 18, 2012, 01:12:31 am by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Nspire Java
« Reply #2 on: August 18, 2012, 05:04:20 am »
Why Java? Isn't Lua enough?

Java's performance will definitely be better, possibly much better:
  • Lua is dynamically typed, while Java is statically typed
  • Lua programs must be parsed into tokens/bytecode before execution, Java programs are precompiled into bytecode ready for execution
  • Nspire Lua interpreter was written by TI (automatic performance hit! :D)
There is already C and assembly support on Nspires through Ndless, and those programs are precompiled and not written by TI. But I am sure you already know it since you are probably not going to write your JVM in Lua nor in Basic but probably in C or ASM ;)

Anyway, that seems to me a good idea. SDL was ported to the Nspire series and now I hear people saying "you can use nSDL for your program". Maybe your project will bring some "you can use nJVM for your program", who knows ? That would bring some activity out there for sure since not everybody knows C and some people prefer Java :D
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline lkj

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +58/-1
    • View Profile
Re: Nspire Java
« Reply #3 on: August 18, 2012, 09:10:59 am »
Can the Nspire handle it?

A JVM (Java Virtual Machine) implementation called Lejos has been available for the Lego Mindstorms NXT robotic brick for years already: http://lejos.sourceforge.net/. I will use the Lego NXT as a basis for comparison with the Nspire.

The NXT's specs compared to the original Nspire non-CAS:
NXTNspire
Processor:ARM7 @ 48MHzARM9 eq. @ ~150MHz
RAM:64kB16MB
Flash ROM:256kB20MB

The Lejos project chose to implement Java ME instead of SE for obvious reasons. Java ME is probably the most we can hope for.

Minimum system requirements for Java ME:
RAM:8MB
ROM:5MB
(from http://www.oracle.com/technetwork/java/embedded/resources/me-embeddocs/index.html)

Note that these specs are for Linux. The Nspire's simpler OS should leave even more room to spare. Can the Nspire handle Java ME? I think so.

The OS is from TI, you know. I've heard it uses almost the whole RAM on non-CX Nspires. But compared with the NXT you still have much memory.

I hope this project succeeds and creates more interest in the Nspire :)

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Nspire Java
« Reply #4 on: August 18, 2012, 09:55:51 am »
Quote
and I am somewhat surprised that something similar is not available for the Nspire yet.
It's not surprising at all: the fact is that hardly anybody cares about the Nspire ;)

But your idea could bring more activity, so it should be pursued :)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline DWLooney

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +0/-0
    • View Profile
Re: Nspire Java
« Reply #5 on: August 18, 2012, 12:26:46 pm »
Wow, what a huge undertaking.

It'd be cool, though, if we could port minecraft to the nspire through it. O.O I don't care how slow it runs.

NO HURRY THOUGH, that is the prime numerator with these kind of projects.

Good luck, I would really like to see this come to fruition!

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Nspire Java
« Reply #6 on: August 18, 2012, 04:51:45 pm »
YES! YES! DO IT! :D
In learning java next month, and that would be awesome if I could use it in the nspire too!

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Nspire Java
« Reply #7 on: August 18, 2012, 05:16:06 pm »
Just a correction, the Nspire Lua interpreter is not written by TI. It's the standard lua, just without io and system libs, and some extra libs by them. And libs have nothing to do with the interpreter ;)

Hope you succeed porting it :)

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Nspire Java
« Reply #8 on: August 19, 2012, 02:15:10 am »
Quote
It's the standard lua, just without io and system libs, and some extra libs by them
IOW, it's significantly two-way incompatible with Lua on pretty much other platform.

But yeah, porting some Java framework + library ought to be possible on the Nspire, and unlock some potential (at least once in a while, when native code development is available to users).
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Nspire Java
« Reply #9 on: August 19, 2012, 03:51:29 am »
Quote
It's the standard lua, just without io and system libs, and some extra libs by them
IOW, it's significantly two-way incompatible with Lua on pretty much other platform.
As much as a whole lot of platform-specific programming languages... I don't see why this is so important. Actually, it's "easy" to port what's required to make it work on normal Lua, as Jim's done (and even further, since it runs with JS too). So, when this part is done, it should be really good. (more talking about Cemetech's LuaZM for example, here)

But yeah, porting some Java framework + library ought to be possible on the Nspire, and unlock some potential (at least once in a while, when native code development is available to users).
Indeed, it would be a great new way opening to a lot of things
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Nspire Java
« Reply #10 on: August 19, 2012, 03:47:02 pm »
IOW, it's significantly two-way incompatible with Lua on pretty much other platform.
While true, it not really significant because basically every Lua platform is different .. just take a look at Love2D, Corona, implementations of Lua in games ..
None of those are compatible with each other, none. Also, the TI-Nspire API is pretty close to the one of Love2D (both event based, similar working structure) so porting stuff between those two platforms isn't that hard.

Anyway, I'm going too much of topic here. Sorry for that ^^

Offline _Nicco_

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +6/-0
    • View Profile
Re: Nspire Java
« Reply #11 on: October 21, 2012, 08:19:35 pm »
Does anyone know what happened to this idea?  I'm not a great programmer yet but I'm willing to learn and try to help out.  It seems that all of these Java for Nspire projects die out quickly.  I'm sure that many people including me would like to have java on the Nspire (I'm learning java in my computer science class).  What can I do to help make it happen?
They say that your signature is supposed to go here...

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Nspire Java
« Reply #12 on: October 21, 2012, 08:39:44 pm »
They die out fast because poeple just dont have enough time to work on it.
I do have to admit that having java would be nice...
also, nice necro :)
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline _Nicco_

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +6/-0
    • View Profile
Re: Nspire Java
« Reply #13 on: October 21, 2012, 08:44:59 pm »
Sorry it was the most recent thread on Java for the Nspire.
They say that your signature is supposed to go here...

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Nspire Java
« Reply #14 on: October 21, 2012, 08:59:19 pm »
Qwerty's post actually gives a pretty good explanation.

I'd also add:
Although java would be nice, there are other good options available (C, ARM ASM, Lua). This being the case, java is not seen as a necessity.

Any implementation of Java would require ndless, and TI is constantly updating their OSes. Each update seems to block ndless. This is somewhat discouraging to prospective programmers. The mentality is "Why invest your time if it will all be for nothing?" C and ARM assembly (which also require ndless) already struggle with popularity, I fear Java would be the same.

Time. Such an undertaking is a big commitment, for a few individuals it would be a large undertaking. I think if this were to be pursed, a decently sized team would be a must.

Also, the necro is fine, as it is relevant to the topic. No need to start another thread. :)