我正在尝试为Minecraft定制发射器。我只希望它从我自己的服务器上下载主jar文件,没有别的。我反编译了一个文件(Launcher.java),并将下载URL从“ https://s3.amazonaws.com/Minecraft.Download/”更改为自己的URL。问题是,当我尝试使用javac -classpath launcher.jar launcher.java重新编译它时,它抛出5个错误:
launcher.java:313: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] directories = objectsDir.listFiles(DirectoryFileFilter.DIRECTORY);
launcher.java:317: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] files = directory.listFiles(FileFileFilter.FILE);
launcher.java:409: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] directories = virtualsDir.listFiles(DirectoryFileFilter.DIRECTORY);
launcher.java:441: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] versions = root.listFiles(DirectoryFileFilter.DIRECTORY);
launcher.java:445: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] files = version.listFiles(FileFilterUtils.and(new IOFileFilter[] { new PrefixFileFilter(version.getName() + "-natives-"), ageFilter }));
有什么办法吗?别介意我的写作风格,我整夜试图解决...
提前致谢。
最佳答案
我自己想通了!我需要这样做:
import java.io.FileFilter;
然后从修改每个错误行
File[] directories = objectsDir.listFiles(DirectoryFileFilter.DIRECTORY);
对此:
File[] directories = objectsDir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY);
现在一切正常。
关于java - Minecraft Launcher重新编译,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25739328/