A useful lib for Nxt: JSON

Post your NXJ projects, project ideas, etc here!

Moderators: imaqine, 99jonathan, roger

burti
Novice
Posts: 61
Joined: Thu Jun 25, 2009 11:41 pm

A useful lib for Nxt: JSON

Postby burti » Mon Mar 21, 2011 11:38 pm

Hi everyone,
I adapted a json-lib for Java ME for Lejos.
I have tested it with JUnit without any problems.

It is lightweight and very useful when you exchange structured information over bluetooth/USB between your nxt and your PC.
Download it from http://www.cip.ifi.lmu.de/~mirwaldt/jsonForNxt.zip and try it.
See JSONTest.java how to use the lib.

All the best,
Michael

vyse
New User
Posts: 6
Joined: Wed Mar 23, 2011 2:01 pm

Re: A useful lib for Nxt: JSON

Postby vyse » Wed Apr 06, 2011 5:30 pm

thanks for your library

I've saved a few days of work.

And I tell my experience to use it.

vyse
New User
Posts: 6
Joined: Wed Mar 23, 2011 2:01 pm

Re: A useful lib for Nxt: JSON

Postby vyse » Thu Apr 07, 2011 10:43 am

Hi burti.

what version of libraries you use? 0.85?

With these libraries, I can not compile, There is a bug in json / util / Map.java, line 11 public Enumeration <K> keysEnum ();

Code: Select all

json/util/Map.java:11: type java.util.Enumeration does not take parameters
   public Enumeration<K> keysEnum();


And String java.lang.String.trim() doesn't exist in 0.85

thanks.

vyse
New User
Posts: 6
Joined: Wed Mar 23, 2011 2:01 pm

Re: A useful lib for Nxt: JSON

Postby vyse » Fri Apr 08, 2011 5:06 pm

hi,

Have you used the library 0.9?

With the library 0.9 everything is fine, but I can not use nxjlink or nxj



Code: Select all

nxjlink prueba -o prueba.nxj
Method lejos.nxt.VM.createStackTrace is an unknown native method. You are probably using JDK APIs or libraries that cannot be run under leJOS.
js.tinyvm.TinyVMException: Method lejos.nxt.VM.createStackTrace is an unknown native method. You are probably using JDK APIs or libraries that cannot be run under leJOS.
        at js.tinyvm.MethodRecord.<init>(MethodRecord.java:80)
        at js.tinyvm.ClassRecord.storeMethods(ClassRecord.java:630)
        at js.tinyvm.Binary.processMethods(Binary.java:602)
        at js.tinyvm.Binary.createFromClosureOf(Binary.java:296)
        at js.tinyvm.TinyVMTool.link(TinyVMTool.java:93)
        at js.tinyvm.TinyVMTool.link(TinyVMTool.java:47)
        at js.tinyvm.TinyVM.start(TinyVM.java:100)
        at js.tinyvm.TinyVM.start(TinyVM.java:85)
        at js.tinyvm.TinyVM.main(TinyVM.java:30)



and I do not get compile lejostools (subversion)

User avatar
gloomyandy
leJOS Team Member
Posts: 5898
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: A useful lib for Nxt: JSON

Postby gloomyandy » Fri Apr 08, 2011 9:08 pm

You can't just use the classes.jar from a new build you have to use all of the files from the snapshot including the firmware.


Return to “NXJ Projects”

Who is online

Users browsing this forum: No registered users and 1 guest