3

I installed play framework, and created an application use the template of hello-play-java. when I compile, it has an error:

Refreshing list of source files to watch for changes...
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.NoClassDefFoundError: Could not initialize class org.fusesource.jansi.internal.Kernel32
at org.fusesource.jansi.internal.WindowsSupport.getConsoleMode(WindowsSupport.java:50)
at jline.WindowsTerminal.getConsoleMode(WindowsTerminal.java:177)
at jline.WindowsTerminal.init(WindowsTerminal.java:80)
at jline.TerminalFactory.create(TerminalFactory.java:101)
at jline.TerminalFactory.get(TerminalFactory.java:159)
at sbt.ConsoleLogger$.ansiSupported(ConsoleLogger.scala:86)
at sbt.ConsoleLogger$.<init>(ConsoleLogger.scala:80)
at sbt.ConsoleLogger$.<clinit>(ConsoleLogger.scala)
at sbt.GlobalLogging$.initial(GlobalLogging.scala:40)
at sbt.StandardMain$.initialGlobalLogging(Main.scala:64)
at sbt.StandardMain$.initialState(Main.scala:73)
at sbt.xMain.run(Main.scala:29)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:129)
at xsbt.boot.Launch$.run(Launch.scala:109)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:36)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:19)
at xsbt.boot.Boot$.runImpl(Boot.scala:44)
at xsbt.boot.Boot$.main(Boot.scala:20)
at xsbt.boot.Boot.main(Boot.scala)
[info] Loading project definition from D:\play\playtemplate\hello-play-java\project

My OS is windows 8.1. I tried 32bit and 64bit jdk 1.6 , 64bit jdk1.7, always this error.

What should I do to solve this problem. Thank you.

Sealter
  • 301
  • 3
  • 7

1 Answers1

-1

A NoClassDefFoundError specifies that a class was available during compile time but missing during runtime. In your case org.fusesource.jansi.internal.Kernel32 is either not available or uninitialized during runtime. Trying adding a reference of Jansi jar to your project. You can refer to this regarding how to debug a NoClassDefFoundError

Crickcoder
  • 2,135
  • 4
  • 22
  • 36
  • Thank you for your answer. What I confuse is that there is Jansi jar in play repository. Somebody says play 2.x supports java 8 only, I tried, but still this error. – Sealter Nov 17 '14 at 01:25
  • do you see any other error in the stacktrace - ClassNotFoundException or ExceptionInInitializerError? – Crickcoder Nov 17 '14 at 01:41
  • No, only NoClassDefFoundError – Sealter Nov 17 '14 at 01:50
  • you mentioned, you created a new application hello-play-java. When you run this what is the classpath? Are all your jars available to the application? – Crickcoder Nov 17 '14 at 01:55
  • I created the application in firefox when play is started, the location is http://127.0.0.1:8888/home . In play 2.x, there is no play command, so I use activator ui command to start play, when it is started, it will open a page refered above. In this page, it tells me how I can create an app: 1、Choose a template 2、 Specify a location 3、Activate it. So I choose the template of hello-play-java, but I change the location instead of my user home. I installed play in D:\play\activator-1.2.10 and my app was in D:\playtemplate . The jars in D:\play\activator-1.2.10\repository. They're all avaliable. – Sealter Nov 17 '14 at 02:19