FileNotFoundException even though the file is there?

FileNotFoundException even though the file is there?



I am trying to copy and paste a Minecraft World from a template into the server folder and then load the world. I am getting this error:



java.io.FileNotFoundException:
.C:UsersArchieDesktopServer.b571c7a6-3297-48eb-ac24-1bac65ef9727session.lock
(The filename, directory name, or volume label syntax is incorrect)



So here is what I tried:



Printing out the source of the path and then the place I am copying it to, to console to check it is the correct path, here is what was printed:



C:UsersArchieDesktopServer.b571c7a6-3297-48eb-ac24-1bac65ef9727 (dir to copy to)



C:UsersArchieDesktopServerpluginsSolusgameworld (src)



That is correct. And in that folder the session.lock is literally there:
http://prntscr.com/klc7xp



So I am really confused as to why it is throwing a file not found exception, I've googled it but there doesn't really seem to be a fix.



Here is the code:


private void loadWorld()
File game = new File(Solus.get().getServer().getWorldContainer().getAbsolutePath() + uuid.toString());
if (!game.mkdir())
System.out.println("Couldn't generate the game: " + uuid.toString());


File srcDir = new File(Solus.get().getDataFolder().getAbsolutePath() + File.separator + "gameworld");
System.out.println(game.getPath() + " : " + srcDir.getAbsolutePath());
try
FileUtils.copyDirectory(srcDir, game);
catch (IOException e)
e.printStackTrace();


WorldCreator wc = new WorldCreator(game.getAbsolutePath());
wc.createWorld();
this.world = Bukkit.getServer().createWorld(wc);



Code explanation:





Nope, assertion is wrong - .C: is not C:. The file really doesn't exist at that path. That should be sufficient information to fix the issue.
– user2864740
Aug 21 at 18:50



.C:


C:





try to debug it after removing the lock and while the file is locked, check if you are getting the same exception? stackoverflow.com/questions/1500174/…
– Vishrant
Aug 21 at 18:52





Specifically .somefilename is telling java to look for somefilename in the local directory, so don't tell it to do that. Create a String filename = ....; and pass that to new File(filename), so you can use System.out.println() to see whether it's actually creating the right kind of filepath or not. Right now, it's creating a relative path instead of an absolute one.
– Mike 'Pomax' Kamermans
Aug 21 at 18:52



.somefilename


somefilename


String filename = ....;


new File(filename)


System.out.println()





Mike, this is what I have done, String path = game.getAbsolutePath(); System.out.println("PATH:" + path); WorldCreator wc = new WorldCreator(path); It is still doing exactly the same error, nothing has changed. Any help?
– Archie
Aug 21 at 19:07






The actual directory is Server.b571c7a6-3297-48eb-ac24-1bac65ef9727 but you've got Server.b571c7a6-3297-48eb-ac24-1bac65ef9727. You're missing a separator.
– Klitos Kyriacou
Aug 21 at 20:02


Server.b571c7a6-3297-48eb-ac24-1bac65ef9727


Server.b571c7a6-3297-48eb-ac24-1bac65ef9727









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ

How do I collapse sections of code in Visual Studio Code for Windows?