In my program I want to execute some function with different working directory (I’ve loaded JAR which working with files in current directory and want to execute it)
Is there a way to execute Runnable or Thread or some else object with setting working directory?
No, working directories are associated with OS-level processes, you cannot change it in part of the program. You will have to change the way the directory is obtained.
(I assume that you currently either obtain the directory with System.getProperty(“user.dir”), or invoke code that similarly gets the directory from the environment.)
Clarification: you can of course change the property globally, but then it changes in all threads. I assume that this is not what you want, since you talk about threads.