Running Play Framework 2.0 in Windows, got a NoCla

2019-08-09 14:26发布

问题:

I'm trying to run Play Framework 2.0 in windows (XP), but when I launch play, I got this exception :

>play.bat
Exception in thread "main" java.lang.NoClassDefFoundError: and
Caused by: java.lang.ClassNotFoundException: and
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: and.  Program will exit.

I can't find why I have this error. Of course I have Java installed :

>java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)

And javac :

>javac -version
javac 1.6.0_31

What am I missing?

Thanks for your help.

回答1:

Ok, for those who have the same problem, it's quite simple in fact.

I was running Play in "My Documents" and the whole path contained space.

In order for Play! to work, you'll have to put your project in a folder without spaces, like :

C:\dev\play\2.0\

And it will work :)