This discussion is archived
2 Replies Latest reply: Mar 2, 2010 2:11 AM by 843851 RSS

I am getting com.sun.kvem.ktools.ExecutionException error

843851 Newbie
Currently Being Moderated
Below is the error that I get in the console while building the midlet in J2ME Wireless ToolKit 2.0

Building "ParseXML"
C:\WTK20\apps\ParseXML\src\ParseXMLService.java:1: illegal character: \187
+import javax.microedition.midlet.*;*+
*^*
C:\WTK20\apps\ParseXML\src\ParseXMLService.java:1: illegal character: \191+
*import javax.microedition.midlet.*;
+^+
+2 errors+
com.sun.kvem.ktools.ExecutionException
Build failed

Below is the actual java code
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;
//kxml imports
import org.kxml.*;
import org.kxml.parser.*;
public class ParseXML extends MIDlet implements CommandListener {
private Command exitCommand; // The exit command
private Command displayXML; // On execution, it displays title and description
// on phone screen
private Display display; // The display for this MIDlet
// UI Items for display of title and description on phone screen
private static TextBox t;
private static String textBoxString = "";
// XML String
private String xmlStr = "";
public ParseXML() {
display = Display.getDisplay( this );
exitCommand = new Command( "Exit", Command.EXIT, 2 );
displayXML = new Command( "XML", Command.SCREEN, 1 );
// The XML String in form of RSS
StringBuffer xmlString = new StringBuffer();
xmlString.append("<?xml version=\"1.0\"?><!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"");
xmlString.append("\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">");
xmlString.append("<rss version=\"0.91\">");
xmlString.append("<channel><title>Meerkat: An Open Wire Service</title>");
xmlString.append("<link>http://meerkat.oreillynet.com</link>");
xmlString.append("<description>Meerkat is a Web-based syndicated content reader based on RSS (\"Rich Site Summary\"). RSS is a fantastic, simple-yet-powerful syndication system rapidly gaining momentum.");
xmlString.append("</description><language>en-us</language>");
xmlString.append("</channel>");
xmlString.append("</rss>");
xmlStr = xmlString.toString();
}
public void startApp() {
// The textbox displays title and description from a RSS String
t = new TextBox( "MIDlet XML", "kXML", 256, 0 );
t.addCommand( exitCommand );
t.addCommand( displayXML );
t.setCommandListener( this );
display.setCurrent( t );
}
/**
Pause is a no-op since there are no background activities or
record stores that need to be closed.
*/
public void pauseApp() { }
/**
Destroy must cleanup everything not handled by the garbage collector.
In this case there is nothing to cleanup.
*/
public void destroyApp(boolean unconditional) { }
/*
Respond to commands, including exit. On the exit command, cleanup
and notify that the MIDlet has been destroyed.
*/
public void commandAction(Command c, Displayable s) {
if ( c == exitCommand ) {
destroyApp( false );
notifyDestroyed();
}
else if ( c == displayXML ) {
try {
viewXML();
}
catch( Exception e ) {
e.printStackTrace();
}
}
}
// This function sets up kxml parser and calls traverse() to parse the whole XML String
public void viewXML() throws IOException {
try {
byte[] xmlByteArray = xmlStr.getBytes();
ByteArrayInputStream xmlStream = new
ByteArrayInputStream( xmlByteArray );
InputStreamReader xmlReader = new
InputStreamReader( xmlStream );
XmlParser parser = new XmlParser( xmlReader );
try
{
traverse( parser, "" );
}
catch (Exception exc)
{
exc.printStackTrace();
}
return;
}
catch ( IOException e ) {
return ;
} finally {
return ;
}
}
/**
Traverses the XML file
*/
public static void traverse( XmlParser parser, String indent ) throws Exception
{
boolean leave = false;
String title = new String();
String desc = new String();
do {
ParseEvent event = parser.read ();
ParseEvent pe;
switch ( event.getType() ) {
// For example, <title>
case Xml.START_TAG:
// see API doc of StartTag for more access methods
// Pick up Title for display
if ("title".equals(event.getName()))
{
pe = parser.read();
title = pe.getText();
}
// Pick up description for display
if ("description".equals(event.getName()))
{
pe = parser.read();
desc = pe.getText();
}
textBoxString = title + " " + desc;
traverse( parser, "" ) ; // recursion call for each <tag></tag>
break;
// For example </title?
case Xml.END_TAG:
leave = true;
break;
// For example </rss>
case Xml.END_DOCUMENT:
leave = true;
break;
// For example, the text between tags
case Xml.TEXT:
break;
case Xml.WHITESPACE:
break;
default:
}
} while( !leave );
t.setString( textBoxString );
}
}

  • 1. Re: I am getting com.sun.kvem.ktools.ExecutionException error
    DarrylBurke Guru Moderator
    Currently Being Moderated
    Use code tags to post codes -- [code]CODE[/code] will display as
    CODE
    Or click the CODE button and paste your code between the {code} tags that appear.

    db
  • 2. Re: I am getting com.sun.kvem.ktools.ExecutionException error
    843851 Newbie
    Currently Being Moderated
    Below is the error that I get in the console while building the midlet in J2ME Wireless ToolKit 2.0

    Building "ParseXML"
    C:\WTK20\apps\ParseXML\src\ParseXMLService.java:1: illegal character: \187
    import javax.microedition.midlet.;
    ^
    C:\WTK20\apps\ParseXML\src\ParseXMLService.java:1: illegal character: \191
    import javax.microedition.midlet.;
    ^
    2 errors
    com.sun.kvem.ktools.ExecutionException
    Build failed

    Below is the actual java code
    import javax.microedition.midlet.;
    import javax.microedition.lcdui.;
    import javax.microedition.io.;
    import java.io.;
    //kxml imports
    import org.kxml.;
    import org.kxml.parser.;
    public class ParseXML extends MIDlet implements CommandListener {
    private Command exitCommand; // The exit command
    private Command displayXML; // On execution, it displays title and description
    // on phone screen
    private Display display; // The display for this MIDlet
    // UI Items for display of title and description on phone screen
    private static TextBox t;
    private static String textBoxString = "";
    // XML String
    private String xmlStr = "";
    public ParseXML() {
    display = Display.getDisplay( this );
    exitCommand = new Command( "Exit", Command.EXIT, 2 );
    displayXML = new Command( "XML", Command.SCREEN, 1 );
    // The XML String in form of RSS
    StringBuffer xmlString = new StringBuffer();
    xmlString.append("<?xml version=\"1.0\"?><!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"");
    xmlString.append("\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">");
    xmlString.append("<rss version=\"0.91\">");
    xmlString.append("<channel><title>Meerkat: An Open Wire Service</title>");
    xmlString.append("<link>http://meerkat.oreillynet.com</link>");
    xmlString.append("<description>Meerkat is a Web-based syndicated content reader based on RSS (\"Rich Site Summary\"). RSS is a fantastic, simple-yet-powerful syndication system rapidly gaining momentum.");
    xmlString.append("</description><language>en-us</language>");
    xmlString.append("</channel>");
    xmlString.append("</rss>");
    xmlStr = xmlString.toString();
    }
    public void startApp() {
    // The textbox displays title and description from a RSS String
    t = new TextBox( "MIDlet XML", "kXML", 256, 0 );
    t.addCommand( exitCommand );
    t.addCommand( displayXML );
    t.setCommandListener( this );
    display.setCurrent( t );
    }
    /
    Pause is a no-op since there are no background activities or
    record stores that need to be closed.
    /
    public void pauseApp() { }
    /*
    Destroy must cleanup everything not handled by the garbage collector.
    In this case there is nothing to cleanup.
    /
    public void destroyApp(boolean unconditional) { }
    /
    Respond to commands, including exit. On the exit command, cleanup
    and notify that the MIDlet has been destroyed.
    /
    public void commandAction(Command c, Displayable s) {
    if ( c == exitCommand ) {
    destroyApp( false );
    notifyDestroyed();
    }
    else if ( c == displayXML ) {
    try {
    viewXML();
    }
    catch( Exception e ) {
    e.printStackTrace();
    }
    }
    }
    // This function sets up kxml parser and calls traverse() to parse the whole XML String
    public void viewXML() throws IOException {
    try {
    byte[] xmlByteArray = xmlStr.getBytes();
    ByteArrayInputStream xmlStream = new
    ByteArrayInputStream( xmlByteArray );
    InputStreamReader xmlReader = new
    InputStreamReader( xmlStream );
    XmlParser parser = new XmlParser( xmlReader );
    try
    {
    traverse( parser, "" );
    }
    catch (Exception exc)
    {
    exc.printStackTrace();
    }
    return;
    }
    catch ( IOException e ) {
    return ;
    } finally {
    return ;
    }
    }
    /*
    Traverses the XML file
    */
    public static void traverse( XmlParser parser, String indent ) throws Exception
    {
    boolean leave = false;
    String title = new String();
    String desc = new String();
    do {
    ParseEvent event = parser.read ();
    ParseEvent pe;
    switch ( event.getType() ) {
    // For example, <title>
    case Xml.START_TAG:
    // see API doc of StartTag for more access methods
    // Pick up Title for display
    if ("title".equals(event.getName()))
    {
    pe = parser.read();
    title = pe.getText();
    }
    // Pick up description for display
    if ("description".equals(event.getName()))
    {
    pe = parser.read();
    desc = pe.getText();
    }
    textBoxString = title " " desc;
    traverse( parser, "" ) ; // recursion call for each <tag></tag>
    break;
    // For example </title?
    case Xml.END_TAG:
    leave = true;
    break;
    // For example </rss>
    case Xml.END_DOCUMENT:
    leave = true;
    break;
    // For example, the text between tags
    case Xml.TEXT:
    break;
    case Xml.WHITESPACE:
    break;
    default:
    }
    } while( !leave );
    t.setString( textBoxString );
    }
    }