Play Framework cannot compile my class, showing me strange character in my stacktrace
I am developing a web application with Play! Framework using No开发者_如何学Pythontepad++ on windows xp. whenever I create new class, save and refresh the browser to see the changes, I get the following error:
The file /app/utils/NameUtil.java could not be compiled. Error raised is : The declared package "" does not match the expected package "utils")
In /app/utils/NameUtil.java (around line 1)
1: i↓mport java.util.; 2: import models.;
3: import java.lang.*; 4: import play.Logger; 5: 6: public class NameUtil { 7:if you notice line 1, there is a strange charecter which is not visible in my text editor. I've tried to change my text format from utf-8 to ansi and from dos/windows to unix, but it's no use.
What is the problem exactly? and if it's encoding problem, shouldn't playframework support utf-8 formats?
Thanks
It's possible that it's trying to use escape sequences to highlight the error, or something like that.
The correct fix for the compiler error itself is to following the compiler error, and add:
package utils;
as the first line of the file.
See whether you see the same kind of behaviour when you get other compiler errors. (You're about to get one due to your current first line of import java.util;
- that should be import java.util.*;
or a particular class within the java.util
package, assuming that this is meant to be a normal Java file.)
As an aside, I haven't used the Play! framework myself, but is there any reason why you want to use Notepad++ rather than an IDE such as Netbeans, Eclipse or IntelliJ? Do they not play nicely with "Play!"?
精彩评论