当我在JavaFX中使用打开的对话框时,收到此奇怪的错误消息。
$ java FileChoose
objc[57243]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fff86988c90) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x12e797cd8). One of the two will be used. Which one is undefined.
文件打开得很好,但是在 控制台令人不安。这是“违规”代码。
openItem.setOnAction( e ->
{
FileChooser fc = new FileChooser();
fc.setTitle("Open File...");
File f = fc.showOpenDialog(primary);
if(f == null)
{
return; //user hit cancel; skedaddle
}
currentFile = Optional.of(f);
try
{
BufferedReader br = new BufferedReader(new FileReader(currentFile.get()));
StringBuffer sb = new StringBuffer();
String line;
while( ( line = br.readLine()) != null)
{
sb.append(line + "\n");
}
ta.setText(sb.toString());
br.close();
}
catch(FileNotFoundException ex)
{
System.err.printf("File %s not found", currentFile.get().getAbsolutePath());
}
catch(IOException ex)
{
System.err.printf("Death");
}
});
还有其他人看到过这种奇怪吗?这似乎是MacOSX的怪癖。我正在运行High Sierra 10.13.6。