Eclipse打开与可编辑源文件不同的源文件 [英] Eclipse opens different source file than the editable one

查看:197
本文介绍了Eclipse打开与可编辑源文件不同的源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将应用程序运行到eclipse中时,如果抛出异常并在控制台中显示,那么您可以单击链接将您带到源代码文件。

When I run an application into eclipse, if an exception is thrown and is showed in the console, then you are able to click on the links which takes you to the source code file.

很好,问题是,当我点击这些链接时,它们作为外部不可编辑的资源打开(编辑器选项卡中的不同图标,Java源文件有一个蓝色J但这些文件的J为空,只显示边框)。调试时同样的问题,打开的文件与编辑的文件不同。

Fine, the problem is that when I click those links they open as external uneditable resources (different icon in the editor tab, Java source files have a blue J but these files have the J empty, only showing the border). Same problem when debugging, the files opened are not the same tabs as the ones edited.

有关详细信息,正常的源文件显示在标题栏中,如下所示:

For more information, while the normal source files shows in the title bar something like:

project/path/to/source/file.java

其他人显示其完整路径:

The others show its complete path:

C:\absolut\path\to\source\file.java

这很烦人,因为我有从一个回到另一个,我不知道在哪里改变这个或为什么会发生这种情况(很久以前就好了)。

This is quite annoying since I have to go and back from one to the other and I have no idea where to change this or why it is happening (it was alright a time ago).

任何暗示怎么编辑这个?
谢谢

Any hints on how to edit this? Thanks

推荐答案

这是一个类路径问题。单击时,实际上是从类路径访问该文件。

It is a classpath problem. When you click, you are actually accessing the file from the classpath.

要查看Java文件,必须在类路径中添加对项目的引用并移动它到类路径列表的顶部。

To view the Java file, you have to add a reference to your project in the classpath and move it to the top of the classpath list.

这篇关于Eclipse打开与可编辑源文件不同的源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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