背景介绍
开发环境:IntelliJ IDEA COMMUNITY 2019.2
创建名称为 HelloWorld 的 Java 文件时出现以下错误:
Unable to parse template "Class"
Error message: Selected Class file name 'HelloWorld.Java' mapped to not java file type 'Text'.
解决方案
出现这个问题时因为包含的资源包“sun.jvm.hotspot.HelloWorld;”已经有HelloWorld的类,所以IntelliJ IDEA COMMUNITY 2019.2自动判定为非法Java文件而转成Text文件进行创建。建议将 HelloWorld的第一个字母改成小写 helloWorld