我有一个 Eclipse 项目,一些 Java 源代码没有扩展名。当我在 Java 编辑器 中打开它们时,Eclipse 会突出显示关键字,但没有语法/错误检查器。
问题:如何让 eclipse Java Editor 将任何文件视为 .java
文件?
我无法重命名该文件的原因是目录中有一些没有扩展名的外部文件。我将该目录作为源文件夹导入到项目中,但我现在只需要编辑文件,无法重命名它们。
最佳答案
我想以下内容会有帮助:
更新:
正如评论中提到的,无扩展文件的关联被报告为 bug纠结了很久,到现在也没解决。
但是,如果您使用的是 Zend Studio for Eclipse,您可以在 article 中找到建议。 :
What a trick, indeed. Do this at your own risk. If you bork your install, I'll try to help, but ultimately you're on your own.
- Go to your Zend > Zend Studio for Exclipse 6.x > Plugins folder and look for org.eclipse.php.core. Mine was actually a .jar file. If it is a jar file, simply rename the .jar to .zip and decompress. The resulting directory will work the same as the .jar file. (keep the .zip as a backup)
- Search for the string: file-extensions
- Add a comma inside the extension list. Mine looks like this: file-extensions="php,php3,php4,php5,,phtml,inc"
- Save the file and start Zend Studio for Eclipse It turns out that the double comma is interpreted as an empty string, as it should be. But this is dirty, yep. Expect it to be overwritten by your next install, etc. But all files that don't have an extension will now be handled as PHP by Eclipse.
注意: php 代码位于图像内,不幸的是,这就是该文章中嵌入代码的方式。
关于java - 如何让eclipse像java文件一样处理没有扩展名的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28597450/