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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 08-05-2007, 01:45 PM   #1
helch
mostly harmless
helch doesn't litterhelch doesn't litter
 
Posts: 8
Karma: 128
Join Date: Jul 2007
Location: Switzerland
Device: iRex iLiad
script for starting java apps inside contentLister

I've made a python script for starting my java applications out of a comfortable package with the contentLister.

You will need to install python (http://www.mobileread.com/forums/showthread.php?t=12636) first. I need it for proper parsing of the xml manifest file. If someone makes a script doing this with bash or C please let me know.
  • Download here: http://projects.mobileread.com/iliad...tartjar.tar.gz
  • Unpack it somwhere on your iliad, say to /usr/local/startjar/
  • Add this to your er_settings.txt (be very careful..):
    Code:
    [USER_APPLICATIONS]
    uaIDList=SHELL;BROWSER;IPDF;APABIMOBI;IMAGEVIEWER;SETUP;PROFILES;EBA;MOBIPOCKET;ARINC;SLIDESHOW;JAR
    [JAR]
    category=viewer
    arguments=<MANIFEST>
    exec=/usr/local/startjar/startjar.py
    xResourceName=intent
    channel=15
    extensions=jar
    
    ...
    
    [EXTENSION_INFO]
    ...
    jar=/usr/local/startjar/java.png
  • Now to create a beautiful java package just create an empty folder, put there all your jar files and an icon if you like and create a manifest.xml like this:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <package>
            <metadata>
                    <dc-metadata>
                            <Title>Title of your Application</Title>
                            <Description>Description of your Applikation</Description>
                            <Date>2007-01-01T00:00:00</Date>
                            <Format/>
                            <Identifier/>
                            <Language/>
                            <Type/>
                    </dc-metadata>
                    <y-metadata>
                            <startpage>just_one_of_your_jarfiles_to_keep_contentLister_happy.jar</startpage>
                            <image>your_own_icon_if_any.png</image>
                            <version>000</version>
                            <ItemSize>819200</ItemSize></y-metadata>
                    <jar>
                            <jarfile>your_jar_file.jar</jarfile>
                            <jarfile>another_jar_file.jar</jarfile>
                            <jarfile>/home/intent/irex.jar</jarfile>
                            <vm-argument>-v</vm-argument>
                            <vm-argument>-Dfoo.bar=foobar</vm-argument>
                            <startclass>my.package.name.MyApp</startclass>
                            <app-argument>first argument for your application</app-argument>
                            <app-argument>second argument for your application</app-argument>
                    </jar>
            </metadata>
    </package>

Hope you like it.
Feel free to improve!
helch is offline   Reply With Quote
Old 08-06-2007, 02:41 AM   #2
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
well done!
narve is offline   Reply With Quote
Old 10-17-2007, 11:00 AM   #3
yokos
Pac-Man catched my iLiad.
yokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with others
 
yokos's Avatar
 
Posts: 720
Karma: 2571
Join Date: Apr 2006
Location: Germany; next to Baltic Sea
Device: 1st gen iRex iLiad with 2nd ed. battery/case
Well, I reactivate this thread again.

Because of the fact that firmware 2.11 hasn't got a er_settings.txt anymore, some preparation need to be changed.
We have a new configuration file, which lives here:
Code:
/mnt/settings/registry/registry.xml
This should be added maybe to registry.xml:
Code:
<applications>
...
    <application type="JAR">
      <appCategory>viewer</appCategory>
      <execute>=/usr/local/startjar/startjar.py</execute>
      <argMask>_MANIFEST_</argMask>
      <xResourceName>intent</xResourceName>
      <ipcChannel>15</ipcChannel>
      <supportFormat>
        <extName>jar</extName>
      </supportFormat>
      <appIconPath/>
    </application>
	...
  </applications>
Code:
<extensionInfos>
	...
    <extensionInfo>
      <associateApp>JAR</associateApp>
      <associateOrder>1</associateOrder>
      <extName>jar</extName>
      <extIcon>/usr/local/startjar/java.png</extIcon>
    </extensionInfo>
	...
    </extensionInfos>
Is this code above correct?

I wanted to start the sample app Anagrams of the JDK with this manifest.xml.
Code:
<?xml version="1.0" encoding="utf-8"?>
<package>
        <metadata>
                <dc-metadata>
                        <Title>Anagram</Title>
                        <Description/>
                        <Date>2007-01-01T00:00:00</Date>
                </dc-metadata>
                <y-metadata>
                        <startpage>anagrams.jar</startpage>
                        <image>.cover.png</image>
                        <version>000</version>
                        <ItemSize>32768</ItemSize>
	</y-metadata>
                <jar>
                        <jarfile>anagrams.jar</jarfile>
                        <jarfile>/home/intent/irex.jar</jarfile>
                        <vm-argument>-v</vm-argument>
                        <vm-argument>-Dfoo.bar=foobar</vm-argument>
                        <startclass>com.toy.anagrams.ui.Anagrams</startclass>
                </jar>
        </metadata>
</package>
I didn't get it to start, because I renamed a wrong file to manifest.bac.xml with result of manifest with a non correct startclass.
I can't correct my fault because trying to start a java program was my very last action before putting my iLiad in the travelling box for the trip to home.

So "startclass" in manifest.xml should be the same as "Main-Class" in META-INF/MANIFEST.MMF of app's jar file? Right?

Code:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.6.0_03-b05 (Sun Microsystems Inc.)
Main-Class: com.toy.anagrams.ui.Anagrams
Class-Path: 
X-COMMENT: Main-Class will be added automatically by build
Thx helch for your work.
yokos is offline   Reply With Quote
Old 10-17-2007, 11:42 AM   #4
helch
mostly harmless
helch doesn't litterhelch doesn't litter
 
Posts: 8
Karma: 128
Join Date: Jul 2007
Location: Switzerland
Device: iRex iLiad
Hi yokos

Quote:
Originally Posted by yokos View Post
Is this code above correct?
Looks fine. Unfortunately I do not have an Iliad available anymore to test because my internship where I had to work with it is over now. Maybe I'll buy one someday (still waiting for an extreme price drop ).

Quote:
Originally Posted by yokos View Post
So "startclass" in manifest.xml should be the same as "Main-Class" in META-INF/MANIFEST.MMF of app's jar file? Right?
That's correct, yes.
And btw: you won't need "<vm-argument>-Dfoo.bar=foobar</vm-argument>", thats just some example argument.

Quote:
Originally Posted by yokos View Post
Thx helch for your work.
Thanks to you too for figuring out how this works in the new registry format.
helch is offline   Reply With Quote
Old 10-17-2007, 11:51 AM   #5
yokos
Pac-Man catched my iLiad.
yokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with others
 
yokos's Avatar
 
Posts: 720
Karma: 2571
Join Date: Apr 2006
Location: Germany; next to Baltic Sea
Device: 1st gen iRex iLiad with 2nd ed. battery/case
Quote:
Originally Posted by helch View Post
Unfortunately I do not have an Iliad available anymore to test because my internship where I had to work with it is over now. Maybe I'll buy one someday (still waiting for an extreme price drop ).
That's a pity.
Q: Ok, how did the refreshment of screen work with any "not prepared for iLiad" jar?
I have downloaded your startjar/python in August but I never used it until this morning. Now I have to wait again until my iLiad comes back.

Last edited by yokos; 10-17-2007 at 11:58 AM. Reason: added: Q
yokos is offline   Reply With Quote
Old 10-17-2007, 12:37 PM   #6
helch
mostly harmless
helch doesn't litterhelch doesn't litter
 
Posts: 8
Karma: 128
Join Date: Jul 2007
Location: Switzerland
Device: iRex iLiad
Quote:
Originally Posted by yokos View Post
Q: Ok, how did the refreshment of screen work with any "not prepared for iLiad" jar?
Basically it won't I just used it with my own prepared-for-iLiad jars...

In the best case, when you've got the source, you can insert the refresh calls (irex.jar api) at the correct places.

Otherwise you can try using the hacked X11 libraries. That would be inserting something like:
Code:
os.environ['LD_LIBRARY_PATH']='/path/to/hacked/libX11.so:' + os.environ['LD_LIBRARY_PATH']
into startjar.py. But I'm not sure if that will work. See also the threads about that hacked lib.
helch 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
Custom Java apps/booklets on Kindle? dumky Kindle Developer's Corner 10 02-10-2009 03:26 PM
iLiad Better contentLister rudysplif iRex Developer's Corner 5 11-26-2008 11:11 PM
contentLister not starting :( thetechnobear iRex 2 12-02-2007 12:59 PM
iLiad Replacing the contentlister tribble iRex Developer's Corner 21 06-22-2007 03:58 PM
[Apple]Java Embedding Plugin 0.9.2: Force java to run in browsers other than Safari Zire Lounge 4 05-24-2005 09:12 PM


All times are GMT -4. The time now is 07:41 AM.


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