I copyed the code from http://pivot.apache.org/tutorials/hello-world.html to
my eclipse
But i could not run it successfully as an application
And the console show me:
java.lang.ClassNotFoundException: org/apache/pivot/tutorials/HelloJava
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at
org.apache.pivot.wtk.DesktopApplicationContext.main(DesktopApplicationContext.java:601)
at
org.apache.pivot.wtk.DesktopApplicationContext.main(DesktopApplicationContext.java:870)
at org.apache.pivot.tutorials.HelloJava.main(HelloJava.java:56)
my code is:
package org.apache.pivot.tutorials;
import java.awt.Color;
import java.awt.Font;
import org.apache.pivot.collections.Map;
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.HorizontalAlignment;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.VerticalAlignment;
import org.apache.pivot.wtk.Window;
public class HelloJava implements Application {
private Window window = null;
@Override
public void startup(Display display, Map<String, String> properties) {
window = new Window();
Label label = new Label();
label.setText("Hello World!");
label.getStyles().put("font", new Font("Arial", Font.BOLD, 24));
label.getStyles().put("color", Color.RED);
label.getStyles().put("horizontalAlignment",
HorizontalAlignment.CENTER);
label.getStyles().put("verticalAlignment",
VerticalAlignment.CENTER);
window.setContent(label);
window.setTitle("Hello World!");
window.setMaximized(true);
window.open(display);
}
@Override
public boolean shutdown(boolean optional) {
if (window != null) {
window.close();
}
return false;
}
@Override
public void suspend() {
}
@Override
public void resume() {
}
public static void main(String[] args) {
DesktopApplicationContext.main(HelloJava.class, args);
}
}
--
View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/Why-i-can-not-run-HelloJava-as-an-application-tp4022617.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.