Hello,
I am developing a quite simple application for a ATID pocket PC with Windows CE 5.00 and 128 Mb.
The applications consists of a simple frame with some basic components. When Mysaifu tries to paint the frame it causes a 'Exception in thread "Thread-1" java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.wce.WCEToolkit' because the JVM does not find the wcepeer library'.
I can assure you that that library exists and is on the correct path (just take a look to the code I give you).
You can find the source code and all the details about the error here:
// -------------- PROGRAM OUTPUT ----------------------
\Program Files\Mysaifu JVM\jre\bin
null
wcepeer.dll exists.
Exception in thread "Thread-1" java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.wce.WCEToolkit
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:607)
at java.awt.
GraphicsEnvironment.getLocalGraphicsEnvironment(
GraphicsEnvironment.java:103)
at java.awt.Window.<init>(Window.java:133)
at java.awt.Frame.<init>(Frame.java:246)
at java.awt.Frame.<init>(Frame.java:234)
at vista.Vista.<init>(Unknown source)
at vista.Vista.main(Unknown source)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:356)
at java.lang.VMMainThread$1.run(VMMainThread.java)
at java.lang.VMThread.run(VMThread.java:120)
Caused by: java.lang.ExceptionInInitializerError
at java.lang.VMClassLoader.loadClass(Native Method)
at java.lang.
ClassLoader.loadClass(
ClassLoader.java:328)
at java.lang.
ClassLoader$1.loadClass(
ClassLoader.java:1112)
at java.lang.
ClassLoader.loadClass(
ClassLoader.java:293)
at java.lang.VMClass.forName(Native Method)
at java.lang.Class.forName(Class.java:233)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:583)
...10 more
Caused by: java.lang.UnsatisfiedLinkError: Native library wcepeer' not found (as file wcepeer') in gnu.classpath.boot.library.path and java.library.path
at java.lang.Runtime.loadLibrary(Runtime.java:763)
at java.lang.System.loadLibrary(System.java:662)
at gnu.java.awt.peer.wce.WCEToolkit.<clinit>(WCEToolkit.java)
at java.lang.VMClassLoader.loadClass(Native Method)
...16 more
JVM exit
//----------------- SOURCE -----------------------------
package vista;
import java.awt.Frame;
import java.awt.Rectangle;
import java.awt.Label;
import java.awt.TextField;
import java.awt.TextArea;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.Button;
import java.io.File;
public class Vista extends Frame {
private static final long serialVersionUID = 1L;
private Label label = null;
private TextField textField = null;
private TextArea textArea = null;
private Button button = null;
/**
* This method initializes textField
*
* @return java.awt.TextField
*/
private TextField getTextField() {
if (textField == null) {
textField = new TextField();
textField.setBounds(new Rectangle(28, 61, 174, 23));
textField.setText("Campo de texto");
}
return textField;
}
/**
* This method initializes textArea
*
* @return java.awt.TextArea
*/
private TextArea getTextArea() {
if (textArea == null) {
textArea = new TextArea();
textArea.setBounds(new Rectangle(28, 89, 171, 41));
textArea.setText("Campo de texto");
}
return textArea;
}
/**
* This method initializes button
*
* @return java.awt.Button
*/
private Button getButton() {
if (button == null) {
button = new Button();
button.setBounds(new Rectangle(228, 61, 53, 23));
button.setLabel("Cerrar");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
}
return button;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(System.getProperty("java.library.path"));
System.out.println(System.getProperty("gnu.classpath.boot.library.path"));
File file = new File(System.getProperty("java.library.path") + File.separatorChar + "wcepeer.dll");
if(file.exists()){
System.out.println("wcepeer.dll exists.");
}else{
System.out.println("wcepeer.dll doesn't exists!!");
}
new Vista();
}
/**
* This is the default constructor
*/
public Vista() {
super();
initialize();
setVisible(true);
addWindowListener(new WindowListener() {
@Override
public void windowOpened(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeactivated(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosing(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosed(WindowEvent e) {
// TODO Auto-generated method stub
System.exit(0);
}
@Override
public void windowActivated(WindowEvent e) {
// TODO Auto-generated method stub
}
});
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
label = new Label();
label.setBounds(new Rectangle(25, 36, 173, 23));
label.setText("Label de prueba");
this.setLayout(null);
this.setSize(298, 296);
this.setTitle("Frame");
this.add(label, null);
this.add(getTextField(), null);
this.add(getTextArea(), null);
this.add(getButton(), null);
}
} // @jve:decl-index=0:visual-constraint="10,1
//------------- ANT FILE -----------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Frame" basedir="." default="jar">
<property name="src.dir" value="src"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<property name="launch.dir" value="launch"/>
<property name="manifest.name" value="mainClass.txt"/>
<property name="mainclass" value="vista.Vista"/>
<property name="
MainClassTxt" value="Main-Class: "/>
<target name="clean" description="Borrar los ficheros">
<delete dir="build" failonerror="false"/>
<delete dir="${launch.dir}" failonerror="false"/>
<target name="compile" depends="clean">
<mkdir dir="${build.dir}"/>
<javac encoding="ISO-8859-1" srcdir="${src.dir}" destdir="${build.dir}"/>
<target name="jar" description="Crear jar" depends="clean, compile">
<mkdir dir="${launch.dir}"/>
<manifest file="${manifest.name}">
<attribute name="Main-Class" value="${mainclass}"/>
<attribute name="Class-Path" value="${manifest.classpath}"/>
</manifest>
<jar destfile="${launch.dir}/${ant.project.name}.jar" basedir="${build.dir}" manifest="${manifest.name}"/>
</target>
</project>
Please, do not hesitate to ask me if you need help.
Thank you,
Miguel.
Comentario
I'm also have this problem and didn't find anywhere how to solve...