Play Framework无法编译我的课程,在我的堆栈跟踪中向我显示了奇怪的字符 [英] Play Framework cannot compile my class, showing me strange character in my stacktrace

查看:70
本文介绍了Play Framework无法编译我的课程,在我的堆栈跟踪中向我显示了奇怪的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Play开发一个Web应用程序!在Windows XP上使用Notepad ++的框架.每当我创建新类时,保存并刷新浏览器以查看更改,就会收到以下错误:

I am developing a web application with Play! Framework using Notepad++ on windows xp. whenever I create new class, save and refresh the browser to see the changes, I get the following error:

无法编译文件/app/utils/NameUtil.java.引发的错误是:声明的软件包"与预期的软件包"utils"不匹配)

The file /app/utils/NameUtil.java could not be compiled. Error raised is : The declared package "" does not match the expected package "utils")

在/app/utils/NameUtil.java中(第1行附近)

In /app/utils/NameUtil.java (around line 1)

1: i↓mport java.util.;
2: 导入模型.
;
3: 导入java.lang.*;
4: 导入play.Logger;
5:
6: 公共类NameUtil {
7:

1: i↓mport java.util.;
2: import models.
;
3: import java.lang.*;
4: import play.Logger;
5:
6: public class NameUtil {
7:

如果您注意到第1行,则有一个奇怪的字符在我的文本编辑器中不可见.我试图将文本格式从utf-8更改为ansi,从dos/windows更改为unix,但这没有用.

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.

到底是什么问题?如果是编码问题,playframework是否不应该支持utf-8格式?

What is the problem exactly? and if it's encoding problem, shouldn't playframework support utf-8 formats?

谢谢

推荐答案

它可能试图使用转义序列来突出显示错误或类似内容.

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;

作为文件的第一行.

查看在遇到其他编译器错误时是否看到相同的行为. (由于当前的import java.util;第一行,您将要获得一个-应该是import java.util.*;java.util包中的特定类,假设这是正常的Java文件.)

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.)

顺便说一句,我还没有使用Play!框架本身,但是有什么理由为什么要使用Notepad ++而不是NetBeans,Eclipse或IntelliJ之类的IDE?他们在"Play!"上玩的不好吗?

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!"?

这篇关于Play Framework无法编译我的课程,在我的堆栈跟踪中向我显示了奇怪的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆