0

I am initiating a session of an external application in my java code. I set the working directory to the bin of the particular application via eclipse debug configurations.And by doing this I am able to launch my application Right now I wanted to generate a runnable jar out of this. How can I set the working directory for this via code or is there any other way I can achieve this? This is what I tried and it is not working.I am getting java.lang.UnsatisfiedLinkError.

File file=new File(".");
    System.out.println("Current Working Directory: " + file.getAbsolutePath());
    System.setProperty("user.dir", GetPropData.getInputDataMappingsElements("pathtext"));
    System.out.println("New Current Working Directory: " + file.getAbsolutePath()

What is the alternative of setting the work space directory in eclipse?

user1312312
  • 605
  • 1
  • 8
  • 16
  • 4
    Possible duplicate of [Changing the current working directory in Java?](https://stackoverflow.com/questions/840190/changing-the-current-working-directory-in-java) – Arnaud Jul 03 '18 at 08:39
  • @Berger I think it's more than that. A more mature way is to accept the working directory path as a parameter and default to "user.dir" system property if none is given. I use Spring so `@Value` injection. However, it can also be achieved through pure Java. – Edward Aung Jul 03 '18 at 13:07

0 Answers0