java - 如何让eclipse像java文件一样处理没有扩展名的文件?

标签 java eclipse syntax

我有一个 Eclipse 项目,一些 Java 源代码没有扩展名。当我在 Java 编辑器 中打开它们时,Eclipse 会突出显示关键字,但没有语法/错误检查器。

问题:如何让 eclipse Java Editor 将任何文件视为 .java 文件?

我无法重命名该文件的原因是目录中有一些没有扩展名的外部文件。我将该目录作为源文件夹导入到项目中,但我现在只需要编辑文件,无法重命名它们。

最佳答案

我想以下内容会有帮助:

enter image description here

更新:

正如评论中提到的,无扩展文件的关联被报告为 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.

  1. 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)
  2. Search for the string: file-extensions
  3. Add a comma inside the extension list. Mine looks like this: file-extensions="php,php3,php4,php5,,phtml,inc"
  4. Save the file and start Zend Studio for Eclipse enter image description here 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/

相关文章:

javascript - 清除 Eclipse 的内部 Web 浏览器

eclipse - 如何让工作台窗口在基于 Eclipse 的项目中打开模式对话框?

Netbeans 8.1 上的 Javascript es6 语法支持

Python if else 条件错误

java - 我的程序中的字符串未正确计算

Java - 迭代 HashMap 替换 ArrayList

java - MIDI 14 位到 7 位转换弯音

java - junit (eclipse) 测试既没有失败也没有通过

ruby - 将错误对象分配给 `rescue` 方法的变量时使用的语法 (=>) 是什么?

java - 返回字符串中的 href