How do I return a file at a specific location in Java? -



How do I return a file at a specific location in Java? -

i using external library function returns file object. works fine making file @ default location, accommodate concurrent users, need have file in specific folder. without beingness able alter function makes file, there file function let's me specify go to?

you can utilize renameto(file destination) in file api rename file storing in abstract path.

ex:

import java.io.file; public class mainclass { public static void main(string args[]) { seek { file oldfile = new file("/usr/bin/temp/"); file newfile = new file("/usr/bin/hunter/temp"); boolean result = oldfile.renameto(newfile); system.out.println(result); } grab (exception e) { e.printstacktrace(); }

also note api says not guaranteed succeed, need check homecoming value of method phone call every time utilize method.

java file

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -