Wednesday 30 March 2011

又是JAVA

    写在前面的话:本来想一直用英文写这个博客的,但是现在能力有限,还是用中文好了。

    最近迷上了kindle 3,居然发现这个东西的系统还是开源的, 在亚马逊的官网用GPL(GNU General Public License)发布了些源码。下载后,看了一眼,好乱,一堆的压缩包。在网上找了下,没有发现有整理好的版本,看来我自己定做个性化kindle 3系统的愿望暂时不容易实现啊。
    不弄系统了,自己移植个浏览器到kindle 3上也好。到处搜索看看K3的APP是如何开发的。发现kindle 3 是用的linux内核,上层应用程序却是JAVA( Running natively in Java, active content has access to our Whispernet mobile network and Kindle’s large e-ink display.)。这点让我想到了android, 看看android的构架:

为啥这些嵌入式设备上层都用JAVA来实现应用呢? JAVA真的这么好? 可惜我不会JAVA,难道我真的要学JAVA了?
    我看kindle 3源码包里面有个:gtk+-2.16.5.tar.bz2 ,这个说明了什么?kindle 3的应用程序应该能用GTK+写才对,那官方为什么说是JAVA呢?难道这个官方发布的代码是很久以前的版本?

Thursday 24 March 2011

ContestAppletProd.jnlp error and solve

ContestAppletProd.jnlp error and solve

There are two versions of java in my PC, and the defult one is java-1.5.0-sun.
I want to use java-6-sun because I am using the JAVA application //ContestAppletProd.jnlp//
from the TopCoder.

That's a really interesting web:
http://www.topcoder.com

Choose java 6, but there's error messages.
$update-java-alternatives -l

java-1.5.0-sun 53 /usr/lib/jvm/java-1.5.0-sun
java-6-sun 63 /usr/lib/jvm/java-6-sun

$sudo update-java-alternatives -s java-6-sun

update-alternatives: error: no alternatives for firefox-javaplugin.so.
update-alternatives: error: no alternatives for iceape-javaplugin.so.
update-alternatives: error: no alternatives for iceweasel-javaplugin.so.
update-alternatives: error: no alternatives for midbrowser-javaplugin.so.
update-alternatives: error: no alternatives for mozilla-firefox-javaplugin.so.
update-alternatives: error: no alternatives for mozilla-javaplugin.so.
update-alternatives: error: no alternatives for mozilla-snapshot-javaplugin.so.
update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so.
update-alternatives: error: no alternatives for xulrunner-javaplugin.so.
update-alternatives: error: no alternatives for mozilla-javaplugin.so.
update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so

Then install the plugins.
$sudo apt-get install sun-java6-plugin
$sudo update-java-alternatives -s java-6-sun

There's also some plugins I can't find.

But I found:

The defult app to open //ContestAppletProd.jnlp// is //Sun Java 5.0 Web Start//.
When I use it there comes out the error message:

com.topcoder.client.ui.UIManagerConfigurationException: The XML configuration for this UI is invalid at line 3 column 85.
at com.topcoder.client.ui.impl.XMLUIManager.create(Unknown Source)
at com.topcoder.client.ui.impl.XMLUIManager.create(Unknown Source)
at com.topcoder.client.contestApplet.ContestApplet.(Unknown Source)
at com.topcoder.client.contestApplet.runner.generic.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at com.sun.javaws.Launcher.executeApplication(Launcher.java:1200)
at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1147)
at com.sun.javaws.Launcher.continueLaunch(Launcher.java:990)
at com.sun.javaws.Launcher.handleApplicationDesc(Launcher.java:519)
at com.sun.javaws.Launcher.handleLaunchFile(Launcher.java:219)
at com.sun.javaws.Launcher.run(Launcher.java:166)
at java.lang.Thread.run(Thread.java:595)
Caused by: com.topcoder.client.ui.UIManagerConfigurationException: The Swing defaults XML configuration is invalid at line 2 column 84.
at com.topcoder.client.ui.impl.XMLUIManager$ConfigurationContentHandler.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:220)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:322)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
... 15 more
Caused by: com.topcoder.client.ui.UIManagerConfigurationException: The Swing defaults XML configuration is invalid at line 2 column 84.
at com.topcoder.client.ui.impl.xml.swing.XMLSwingDefaults.set(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
... 25 more
Caused by: org.xml.sax.SAXParseException: Unknown element 'scheme'.
at com.topcoder.client.ui.impl.xml.swing.XMLSwingDefaults$SwingDefaultsHandler.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:779)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
... 30 more



And I must use the 6.0. After the java 6 installed, then can use the application //Sun Java 6 Web Start//
to open //ContestAppletProd.jnlp//.
all ok.


I can use the app and enjoy the c++ coding.
: )