Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > More E-Book Readers > iRex > iRex Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 05-09-2007, 07:49 AM   #16
tororebelde
No es el toro que piensas
tororebelde began at the beginning.
 
tororebelde's Avatar
 
Posts: 44
Karma: 10
Join Date: Mar 2007
Device: iRex iliad
My first tricks with java over iliad. This is what I'm doing:

Compile a dummy class that show a silly message (on com/irex/sdk):
Code:
javac -source 1.2 -target 1.2 MyOwnTest.java
Create a java package with this new stuff:
Code:
jar cvfm javi.jar Manifest -C com/ .
Manifest is just a java Manifest file with the text "Main-Class: com.irex.sdk.MyOwnTest".

If I lauch this on iliad the following messages arises:
Code:
root@ereader:/home/intent# sys/platform/linux/taoref/er10xx/elate -B sys/platform/linux/taoref/er10xx/target.img -g2 -l sys/platform/linux/taoref/er10xx/ "-capp/stdio/jcode -classpath javi.jar com.irex.sdk.MyOwnTest"
intent (Linux boot loader)
Copyright (c) Tao Systems Ltd 1997-2000

0x564E24 bytes read
Booting image at 0x401ce000-0x405ce400
Sys/kn/init/p_start: Device _init failed [-24] ! '/device/screen' will not be mounted.
app/stdio/jcode: (*env)->FindClass returned an exception
java.lang.NoClassDefFoundError: com.irex.sdk.MyOwnTest
    java.lang.NoClassDefFoundError.<init>(Ljava/lang/String;)V
Obviously: it says that don't know who is MyOwnTest class.
Not obviously (to me): why don't know my class?

Can scotty1024 or other mobileread guru give me a hint? I have never fighted against jar files and I will follow trying to run this, but if somebody here could help me, I would be very grateful
tororebelde is offline   Reply With Quote
Old 05-09-2007, 09:12 AM   #17
narve
iLiad fan
narve can teach chickens to fly.narve can teach chickens to fly.narve can teach chickens to fly.narve can teach chickens to fly.narve can teach chickens to fly.narve can teach chickens to fly.narve can teach chickens to fly.narve can teach chickens to fly.narve can teach chickens to fly.narve can teach chickens to fly.narve can teach chickens to fly.
 
Posts: 210
Karma: 3864
Join Date: Oct 2006
Device: iRex iLiad
Quote:
Originally Posted by tororebelde
My first tricks with java over iliad. This is what I'm doing:

Compile a dummy class that show a silly message (on com/irex/sdk):
Code:
javac -source 1.2 -target 1.2 MyOwnTest.java
Create a java package with this new stuff:
Code:
jar cvfm javi.jar Manifest -C com/ .
You should attach your jar-file, but unless I read it wrong (I don't use jar command line anymore) it should just be
Code:
jar cvfm javi.jar Manifest com
Otherwise the class file will be included with wrong fileprefix (the "com" folder prefix isn't included). You can verify this by opening the jar file in WinZip, 7-zip or similar.
narve is offline   Reply With Quote
Advert
Old 05-09-2007, 05:38 PM   #18
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
elate could care less about your manifest, you have to supply the name of the class to execute on the command line to it.

Here's my test, a slide show program that sucks images out of a ZIP file. It invokes the e-ink updates e.g. its "ported" to the iLiad.

To compile:
javac -classpath irex.jar -source 1.3 -target 1.1 Test1.java

To Jar:
jar cf Test1.jar Test1*.class

To run it I use this shell script:

Code:
#!/bin/sh                                                                       
EXECPATH=sys/platform/linux/taoref/er10xx                                       
IMGPATH=$EXECPATH                                                               
export DISPLAY=:0                                                               
export ELATE_FB_TTY=/dev/tty0                                                   
#export ELATE_KTRACE=/tmp/ktrace.log                                            
export ELATE_DEBUGSTUB=7990                                                     
                                                                                
cd /home/intent/                                                                
if [ ! -d /home/intent/ROOTDIR ]                                                
then                                                                            
   ln -s / ROOTDIR                                                              
fi                                                                              
                                                                                
    JVMARGS="-v -classpath $1;MobipocketCoreReader.jar;kxml2-2.3.0.jar;irex.jar 
    OPTIONS="-capp/stdio/jcode $JVMARGS"                                        
                                                                                
exec $EXECPATH/elate -B $IMGPATH/target.img -g2 -l $EXECPATH "$OPTIONS"
java.sh Test1.jar Test1 ROOTDIR/path/to/file.zip

The elate can't see file's that begin with /, you have to use the ROOTDIR symlink to get to them.

Tap the screen to exit the program.

The -v lets you see the classes load, important for sussing out why elate is having heart burn over your code.

The commented out ktrace lets System.out go to the console.
Attached Files
File Type: zip Test1.zip (4.5 KB, 344 views)

Last edited by scotty1024; 05-09-2007 at 05:40 PM. Reason: a couple more notes
scotty1024 is offline   Reply With Quote
Old 05-09-2007, 05:57 PM   #19
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
Based on the help text it emits it appears there is a developer.img and we have the stripped down target.img. The stack traces it generates contain no line number information (so I don't bother compiling with -g) and generally the messages are cryptic and obtuse.

Here's some of what I have figured out.

Code:
[Loaded java/lang/NoClassDefFoundError/class]
[Loaded java/lang/LinkageError/class]
java.lang.NoClassDefFoundError: `>@
    java.lang.NoClassDefFoundError.<init>(Ljava/lang/String;)V
    Test1.paint(Ljava/awt/Graphics;)V
    java.awt.Component.dispatchEvent(Ljava/awt/AWTEvent;)V
    java.awt.EventQueue$Delegate.dispatchEvent(Ljava/awt/AWTEvent;)V
    java.awt.EventDispatchThread.()V
    java.lang.Thread._run()V
Don't mix .class files from directories and JAR's, all kinds of hell comes from this. Probable bug in elate. Put everything in JAr's and its happy.

Code:
java.lang.NoSuchMethodError
    Test1.<init>()V
    Test1.main([Ljava/lang/String;)V
Somewhere inside the constructor for Test1 you are trying to invoke a method elate doesn't provide in some system class. In this case it was: this.setUndecorated(true);

These can be very annoying to track down. I'm sure Tao has a Java environment with just the supported classes and methods in it but for now...

Code:
app/stdio/jcode: (*env)->FindClass returned an exception
java.lang.NoClassDefFoundError: com.surerange.mobiled.SendFax
    java.lang.NoClassDefFoundError.<init>(Ljava/lang/String;)V
    com.tao_group.sys.Eclassloader.()V
    com.tao_group.sys.Eclassloader.loadClass(Ljava/lang/String;Z)Ljava/lang/Class;
    java.lang.ClassLoader.loadClass(Ljava/lang/String;)Ljava/lang/Class;
I'd like to load your class but it extends or implements something I can't find (bet you'd like to know what this is!) Inspect your extends and implements, usually easy to figure out.

Code:
app/stdio/jcode: (*env)->FindClass returned an exception
java.lang.NoClassDefFoundError: EV
    java.lang.NoClassDefFoundError.<init>(Ljava/lang/String;)V
This is what you get when it can't find the class to be loaded e.g. bad classpath.
scotty1024 is offline   Reply With Quote
Old 05-10-2007, 04:01 AM   #20
tororebelde
No es el toro que piensas
tororebelde began at the beginning.
 
tororebelde's Avatar
 
Posts: 44
Karma: 10
Join Date: Mar 2007
Device: iRex iliad
Quote:
Originally Posted by narve
You should attach your jar-file, but unless I read it wrong (I don't use jar command line anymore) it should just be
Code:
jar cvfm javi.jar Manifest com
Otherwise the class file will be included with wrong fileprefix (the "com" folder prefix isn't included). You can verify this by opening the jar file in WinZip, 7-zip or similar.
Yes indeed, you're right. I didn't used jar command either, and my command was given from jar's help. Your command did the trick. Now I can run very simple examples from iliad so I'll start to do like scotty1024 and try visual classes on it. Thank you very much!
tororebelde is offline   Reply With Quote
Advert
Old 05-10-2007, 11:17 AM   #21
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
The above simple image viewer can be used to demonstrate that Tao didn't accelerate PNG files. GIF and JPG files load very rapidly, sub-second. PNG files though take 6 or 7 seconds to load.
scotty1024 is offline   Reply With Quote
Old 05-10-2007, 12:09 PM   #22
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
A dump of the System Properties from the Intent elate JVM on the iLiad. Sort of a Dog's Breakfast... not quite Desktop, not quite J2ME, not quite Applet.

Note the user.region of GB if you are writing for the North American region.

Code:
http.maxConnections: 5
user.region: GB
file.separator: /
java.content.handler.pkgs: uk.co.tao.net.www.content
line.separator: 

java.compiler: unknown
user.dir: /
java.awt.Component.setCursor.isRestricted: true
microedition.platform: intent JTE
awt.image.animationdelay: 100
microedition.profiles: PBP-1.0,FP-1.0
awt.font.kerning: false
awt.image.type: -1
path.separator: ;
awt.window.refreshMax: 40
os.name: intent
awt.toolkit: com.tao_group.awt.peer.AWTToolkit
os.version: 2.2.1
user.name: unknown
buildlocale: International
awt.image.priority: 5:4:1
awt.window.refreshMin: 20
awt.defaultFont: Serif-plain-12
user.timezone: GMT
awt.image.incrementalDraw: true
awt.image.redrawrate: 100
http.proxySet: false
awt.window.borders: false
awt.repaint.mergefactor: 25
awt.window.buffered: true
java.home: /sys/j
*: added by makefile.jcode.sys
java.class.path: .
user.home: /
os.arch: VP 2.1
net.mimeDecoder: uk.co.tao.net.www.SimpleMime
user.language: en
awt.textured: true
java.awt.event.KeyEvent.supportMask: 2
awt.repaint.priority: 1
java.class.version: 
java.vendor.url: http://www.tao-group.com/
java.protocol.handler.pkgs: uk.co.tao.net.www.protocol
awt.priority: 9
java.vendor: Tao Group Limited
net.simpleMimeFile: /uk/co/tao/net/www/SimpleMime.txt
java.io.tmpdir: /tmp
java.version: 
awt.component.passEvents: true
awt.window.titlebars: false
awt.image.maxThreads: 4
http.defaultConnectionTimeout: 15
java.awt.event.KeyEvent.isRestricted: true
file.encoding: 8859_1
microedition.configuration: CDC-1.0
scotty1024 is offline   Reply With Quote
Old 05-10-2007, 01:44 PM   #23
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
The "applications" in Intent

I don't think all of these are turned on in the provided target.img, xlet for example just returns no matter what arguments you provide.

Code:
app/launch/mem/class
app/launch/mem/_delete
app/launch/mem/_new
app/launch/launchtool
app/launch/process_line
app/dis/tooldbg
app/stdio/javaprofile
app/stdio/jcode
app/stdio/xlet
app/stdio/launch
app/stdio/shutdown
scotty1024 is offline   Reply With Quote
Old 05-10-2007, 01:58 PM   #24
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
All the Applet stuff seems to be missing in action.

For example there is no java.awt.Panel, java.awt.TextArea, or java.awt.ScrollPane.

I don't think iRex realizes how much easier it would be to port Java applets to the iLiad than all those X Windows apps. My guess is that they wanted the smallest target.img they could get away with.

It may be to make this thing really useful we may have to come up with an applet environment. Which could very likely have the iLiad stuff built in and thus allow running stock Java applets.

Last edited by scotty1024; 05-10-2007 at 02:59 PM. Reason: Added more missing Applet classes
scotty1024 is offline   Reply With Quote
Old 05-10-2007, 04:51 PM   #25
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
Lightbulb Java DJVU shows its first page on the iLiad

They say 90% of the battle is knowing you can do something. Here's a screen shot of my hacked version of the Java DJVU Viewer running in Intent on the iLiad.

Now that I've got a page up, time to get the rest of the iRex API implemented so I can page around inside the document.
Attached Thumbnails
Click image for larger version

Name:	quantum.png
Views:	473
Size:	48.9 KB
ID:	3476  
scotty1024 is offline   Reply With Quote
Old 05-15-2007, 07:32 AM   #26
tororebelde
No es el toro que piensas
tororebelde began at the beginning.
 
tororebelde's Avatar
 
Posts: 44
Karma: 10
Join Date: Mar 2007
Device: iRex iliad
Quote:
Originally Posted by scotty1024
All the Applet stuff seems to be missing in action.

For example there is no java.awt.Panel, java.awt.TextArea, or java.awt.ScrollPane.

I don't think iRex realizes how much easier it would be to port Java applets to the iLiad than all those X Windows apps. My guess is that they wanted the smallest target.img they could get away with.
java.awt.Button and java.awt.TextField are missing too. What the heck!

There's no choice to give user an ordinary input??
Ouf, I'll continue doing dummy things
tororebelde is offline   Reply With Quote
Old 05-15-2007, 08:48 AM   #27
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
Tao sells a variety of Booster Packs for their Intent environment. iRex bought what iRex bought.

iRex got into a similar problem with the Mobipocket Viewer and dealt with it by adding in stuff, probably from GNU's Classpath project. I've been investigating adding an AWT, Applet and Swing booster pack from that source.. I'm actually thinking it might be possible to have Applets be automatically ported to the iLiad by tweaking the Applet support elements with the iLiad calls in the right places.
scotty1024 is offline   Reply With Quote
Old 05-15-2007, 12:16 PM   #28
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
More on buttons.

iRex supplies a light weight button:

com.irex.mobipocket.reader.SimpleButton

public SimpleButton(String label, Graphics g, int x, int y, int w, int h)

Code:
        Graphics g = getGraphics();
        SimpleButton sb = new com.irex.mobipocket.reader.SimpleButton("OK", g, 100, 100, -1. -1); // -1 gets you whichever of 200x50
        sb.paint();
        addMouseListener(new MouseAdapter() {

            public void mouseClicked(MouseEvent mouseevent)
            {
                if(sb.getBounds().contains(mouseevent.getPoint()))
                {
                    System.out.println("clicked on button:" + mouseevent.getPoi\
nt());
                }
            }

        }
);
So there you go, a simple button for you to use.
scotty1024 is offline   Reply With Quote
Old 05-15-2007, 03:05 PM   #29
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
Hmm, I've used reflection to study the java.awt.Component in the target.img and there is no getPeer or setPeer. My guess is they use deus ex machina to hook up the peers in their library. We have the peers in the image but the classes to utilize them are missing and I suspect the classes have to pre-bound into the target.img for deus ex machina to work.

So I'm going to do like iRex and adapt light weight components to java.awt interfaces. Except unlike iRex I'm going to do it properly.

I've also got a full java.applet from GNU's Classpath and I'm welding that together for the iLiad.

In time we may have a full javax.swing as well.

I don't know how Cellphone Java Games will look on the iLiad's slow e-ink panel but we should be ready to try them shortly.
scotty1024 is offline   Reply With Quote
Old 05-15-2007, 05:24 PM   #30
Bert
Enthusiast
Bert plays well with othersBert plays well with othersBert plays well with othersBert plays well with othersBert plays well with othersBert plays well with othersBert plays well with othersBert plays well with othersBert plays well with othersBert plays well with othersBert plays well with others
 
Posts: 43
Karma: 2898
Join Date: Jan 2007
Location: Belgium
Device: iRex iLiad, PRS-600
Maybe this is a silly suggestion, but couldn't you just compile the necessary classes yourself? Sun made most of java open source, the (almost) complete source code can be found here (it seems some stuff from the graphics classes - mainly Java2D stuff - is missing because of some copyright issues). For example here is the AWT source.
Bert is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
iRex DR1000 Development VMWare Image Adam B. iRex 9 08-19-2010 04:23 AM
iRex DR1000 Software Development website vwinstead iRex 23 02-04-2009 12:21 PM
iRex Community Development Help Adam B. iRex 33 02-02-2008 07:12 PM
iRex Open Community Development Adam B. iRex 16 12-05-2007 04:31 PM
iLiad Other Java development options...? thisisfrancis iRex Developer's Corner 5 09-27-2007 09:23 AM


All times are GMT -4. The time now is 11:48 AM.


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