Aha! I see the problem now. Your class does not implement Application, so the 
main() method approach I suggested won't work.

If you want to run your app as-is, right-click on the BXML file, not the Java 
file. That will allow you to run it as a Script Application.

For "real" development, you'll probably want to implement Application directly. 
There are a few examples in the tutorial that show how to do this.

G

On May 3, 2011, at 1:12 PM, noobmike wrote:

> I am using Eclipse Helios (3.6.2) - Eclipse IDE for Java Developers, and I'm
> glad I got it installed properly, but I thought if it was installed properly
> you wouldn't have to add the .jars each time. Oh well, this isn't the
> problem at hand! ha ha. 
> 
> at first I added what you suggested: 
> 
> public static void main(String[] args) {
>        DesktopApplicationContext.main(PushButtons.class, args);
>    } 
> 
> which told me I had to Typecast it, which I did :
> 
> public static void main(String[] args) {
>        DesktopApplicationContext.main((Class<? extends Application>)
> PushButtons.class, args);
>    } 
> 
> then I had the option to Run > Run As > Java Application. Which I knew
> wasn't correct because I want the Run As > Pivot Application. Well I ran it
> anyway and got the error :
> 
> Exception in thread "main" java.lang.ClassCastException:
> org.apache.pivot.tutorials.buttons.PushButtons cannot be cast to
> org.apache.pivot.wtk.Application
>       at
> org.apache.pivot.wtk.DesktopApplicationContext.main(DesktopApplicationContext.java:569)
>       at
> org.apache.pivot.wtk.DesktopApplicationContext.main(DesktopApplicationContext.java:802)
>       at 
> org.apache.pivot.tutorials.buttons.PushButtons.main(PushButtons.java:35)
> 
> I tried messing around with the Run Configurations, at first it was set to:
> org.apache.pivot.tutorials.buttons.PushButtons which gave me the above
> error. I know this makes more sense because it is the main class, but I am
> just trying everything I can, so I switched it to:
> org.apache.pivot.wtk.DesktopApplicationContext this gave me the same error
> as before: 
> Application class name is required. 
> 
> About adding the main() to my project, my end goal is to make stand alone
> IIA's is this the way to go? 
> I'm not quite sure what goes into finalizing all of that. 
> 
> Thanks again Greg. 
> 
> --
> View this message in context: 
> http://apache-pivot-users.399431.n3.nabble.com/Application-class-name-is-required-tp2894336p2895061.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Reply via email to