简体   繁体   English

java.nio.file.InvalidPathException

[英]java.nio.file.InvalidPathException

I am making a minecraft server...and I have a IllegalChar error Here is the log: 我正在制作一个我的世界服务器...并且我有一个IllegalChar错误,这是日志:

Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:FOO\server.properties
    at sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
    at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
    at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
    at sun.nio.fs.WindowsPath.parse(Unknown Source)
    at sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
    at java.io.File.toPath(Unknown Source)
    at com.sukkit.Info.loadProperties(FOO2.java:31)
    at com.sukkit.Sukit.main(FOO.java:17)

Here is the server.properties file: 这是server.properties文件:

generator-settings=
allow-nether=true
level-name=world
enable-query=false                       --FOURTH LINE
allow-flight=false
server-port=25565
level-type=DEFAULT
enable-rcon=false
force-gamemode=false
level-seed=
server-ip=
max-build-height=256
spawn-npcs=true
white-list=false
spawn-animals=true
hardcore=false
texture-pack=
online-mode=true
pvp=true
difficulty=1
gamemode=0
max-players=20
spawn-monsters=true
generate-structures=true
view-distance=10
motd=A Minecraft Server

And here is the code: 这是代码:

File extFile = new File("server.properties");//create external file
File inFile = new File(MAINFOO.getCodeBase(*/I HAVE CREATED THIS METHOD IN THE MAIN FOO CLASS*/)+"server.properties");//create internal file
if (!extFile.exists()){
    OutputStream out;
    try {out = new FileOutputStream(extFile);
    Files.copy(inFile.toPath(), out);
    } catch (FileNotFoundException e) {
        Sukit.logE(e.toString());
        Sukit.getLogger().severe("ERROR: FILE IS CORRUPT...PLEASE REDOWNLOAD SUKIT");
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

Here is the MAINFOO.getCodeBase() method: 这是MAINFOO.getCodeBase()方法:

public static String getCodeBase() {
    String i = ClassLoader.getSystemResource("server.properties").toString();
    String is[] = i.split("server.properties");
    logD(is[0]);
    return is[0];
}

I do not have a single : in my properties file... HELP 我的属性文件中没有一个:帮助

The problem is not the file. 问题不在于文件。 The problem is the file name: file:FOO\\server.properties . 问题在于文件名: file:FOO\\server.properties Notice that at index 4 (character 5), you have a : . 请注意,在索引4(字符5)处,您有一个: Instead, you should just use FOO\\server.properties and omit the file: . 相反,您应该只使用FOO\\server.properties并忽略file:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有getPath的java.nio.file.InvalidPathException - java.nio.file.InvalidPathException with getPath 系统错误:java.nio.file.InvalidPathException: - SystemError: java.nio.file.InvalidPathException: 为什么这会抛出 java.nio.file.InvalidPathException? - Why does this throw java.nio.file.InvalidPathException? 遇到java.nio.file.InvalidPathException:非法char &lt;:&gt; - Encountering java.nio.file.InvalidPathException: Illegal char <:> java.nio.file.InvalidPathException:索引 2 处的非法字符 <:>: - java.nio.file.InvalidPathException: Illegal char <:> at index 2: java.nio.file.InvalidPathException 当路径包含冒号 (:) - java.nio.file.InvalidPathException when the path contains colon (:) Magnolia 5.4在发布/取消发布时升级java.nio.file.InvalidPathException - Magnolia 5.4 upgrade java.nio.file.InvalidPathException on publishing/unpublishing 使用闭包编译器格式化javascript文件时,在索引7处获取到java.nio.file.InvalidPathException:非法char &lt;:&gt; - Got java.nio.file.InvalidPathException:Illegal char <:> at index 7 when formatting javascript file using closure compiler WFLYCTL0080 Spring MVC java.lang.RuntimeException:java.nio.file.InvalidPathException - WFLYCTL0080 Spring MVC java.lang.RuntimeException: java.nio.file.InvalidPathException 在尝试编译 java 文件时获取 java.nio.file.InvalidPathException: Illegal char &lt;*&gt; - Getting a java.nio.file.InvalidPathException: Illegal char <*> while trying to compile java files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM