【问题标题】:Git repository error message with JFileChooser带有 JFileChooser 的 Git 存储库错误消息
【发布时间】:2013-12-30 06:00:13
【问题描述】:

我正在使用 Eclipse。当我使用 JFileChooser 时,消息fatal: Not a git repository (or any of the parent directories): .git 不断出现在控制台中。每当我导航到新文件夹时,都会再次打印相同的消息。我还注意到,如果我导航到一个 git 存储库的文件夹,控制台会打印目录路径而不是错误消息。

这是我使用的代码:

import javax.swing.JFileChooser;

public class JFileChooserTest
{
    public static void main (String[] args)
    {
        JFileChooser test = new JFileChooser ();
        test.showOpenDialog (null);
    }   
}

我尝试在Doctor Java中运行上面的代码,没有出现错误信息,所以我认为问题与Eclipse有关。

为什么会这样?有没有办法关闭这些消息?

【问题讨论】:

    标签: java eclipse swing git jfilechooser


    【解决方案1】:

    我在我的 Win7 机器上遇到了同样的问题(我在谷歌搜索时发现了你的问题)。就我而言,我的代码是:

    Desktop.getDesktop().browse(new File("C:\\test.html").toURI());
    

    我得到了完全相同的错误消息(在错误输出中,没有任何异常):fatal: Not a git repository (or any of the parent directories): .git

    我使用的是 JDK 1.7.0_51。

    我注意到只有当我使用 Eclipse 或批处理文件启动我的应用程序时才会出现此问题。使用 .exe 启动器,代码按预期工作,没有错误消息。 使用“进程监视器”工具,我注意到我的 java.exe 进程执行 Windows 注册表查找(肯定是为了让正确的应用程序打开我的文件),最终导致 Git shell 扩展 DLL,然后我的进程启动命令“git rev-parse --显示前缀”。我正在使用带有来自http://msysgit.github.io 的 Windows shell 扩展的 Git 1.7.11。卸载Git后,我不再收到此错误消息,但请求的网页仍然没有打开:(

    绝对不仅仅是JFileChooser 问题。但肯定是相对于 Windows shell 扩展,而 JVM 原生的东西正在处理文件......

    【讨论】:

    • 我在这里有同样的行为......你的回答解释了它。谢谢。 ;-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 2017-07-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多