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 11-29-2016, 06:12 AM   #1
encol
Addict
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 394
Karma: 750286
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
cvm investigations

Kindles have a Java Virtual Machine located at /usr/java/bin/cvm, so i'm doing some investigations :

I'm able to run a java (non kindlet) textual app with the command:
Code:
/usr/java/bin/cvm -jar FileName.jar
or
Code:
/usr/java/bin/cvm -cp FileName.jar ClassName
but, if i try to run a (non kindlet) swing app i get this error:
Spoiler:
[root@kindle documents]# /usr/java/bin/cvm -jar TestSwing.jar
CVM Capabilities set
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: java/awt/Component
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unkn own Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unkno wn Source)
Caused by: java.lang.ClassNotFoundException: java.awt.Component
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more


if include in the classpath the /usr/java/lib/agui.jar (which contains the java/awt/Component), i get:
Spoiler:
[root@kindle documents]# /usr/java/bin/cvm -cp /usr/java/lib/agui.jar:TestSwing.jar testswing.TestSwing
CVM Capabilities set
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: Prohibited package name: java.awt
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknow n Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unkn own Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unkno wn Source)


if i try to launch a kindlet:
Spoiler:
[root@kindle documents]# /usr/java/bin/cvm -cp /opt/amazon/ebook/lib/Kindlet-2.2.jar:Test.azw2 com.encol.test.Main
CVM Capabilities set
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: java/awt/Component
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unkn own Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unkno wn Source)
Caused by: java.lang.ClassNotFoundException: java.awt.Component
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more


(yes, i know that i can also use the command:
Code:
lipc-set-prop com.lab126.appmgrd start file:///mnt/us/documents/Test.azw2
but i'd like a more "direct" way: launching kindlets via lipc hides for example all System.out.println messages)


if i include the java/awt/Component:

Spoiler:
[root@kindle documents]# /usr/java/bin/cvm -cp /opt/amazon/ebook/lib/Kindlet-2.2.jar:/usr/java/lib/agui.jar:Test.azw2 com.encol.test.Main
CVM Capabilities set
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: Prohibited package name: java.awt
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknow n Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unkn own Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unkno wn Source)



there is any way to launch a swing app or a kindlet via cvm?
encol is online now   Reply With Quote
Old 11-29-2016, 08:39 AM   #2
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210797
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
I can not answer your question now.

But if you open the spoiler in my 'JBpatch continued' thread, you will find useful information.

Things such as the cVM start-up bootclasspath to have it come up fully functional.

I do not split the background information across multiple posts -
I edit it into the existing posts -
So simply subscribing to the thread will not get you auto-notified of additions, you have to look from time to time (at least at the "last edited" date).

One of the next bits of background that will be added (when I am done with it) will be how to run the Kindle's Java installation off-Kindle (so you can change things without bricking the Kindle).
knc1 is offline   Reply With Quote
Advert
Old 11-29-2016, 11:19 AM   #3
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210797
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
I lied, it wasn't in the spoiler (yet) it is only in my notes:
Code:
/usr/java/bin/cvm \
-Dsun.boot.library.path=/usr/java/lib \
-Xbootclasspath/a:/usr/java/lib/arm:/usr/java/lib/ext:/usr/java/lib/arm/minimal \
-cp <your application's classpath> \
<your application> <your arguments>
Note: Even with all of that, it does not support signed jars (but neither does Amazon/Lab126).

Last edited by knc1; 11-29-2016 at 11:21 AM.
knc1 is offline   Reply With Quote
Old 11-30-2016, 05:54 AM   #4
encol
Addict
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 394
Karma: 750286
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
Quote:
Originally Posted by knc1 View Post
Note: Even with all of that, it does not support signed jars (but neither does Amazon/Lab126).
same result also with non-signed swing jars
encol is online now   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
cvm h1ro Kindle Developer's Corner 12 04-02-2013 07:25 AM
Least intrusive way to order cvm classpath? ixtab Kindle Developer's Corner 7 11-12-2012 12:04 PM
OFT launches investigations into ebook agency pricing Grumpyreader News 37 02-04-2011 10:29 AM
Troubleshooting Can't Update & Jailbreak due to cvm checksum failure driverever Amazon Kindle 7 01-24-2011 01:45 AM


All times are GMT -4. The time now is 06:45 AM.


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