dynamic path in java application

后端 未结 1 642
萌比男神i
萌比男神i 2021-01-24 13:02

I want to specify the path dynamically. myapp/CopyFolder and myapp/RunFolder\'s are inside application like myapp/WEB-INF. The code I have given below is in .java file(in eclips

1条回答
  •  悲&欢浪女
    2021-01-24 13:40

    You can get the path value as below:

    URL resource = getClass().getResource("/");
    String path = resource.getPath();
    

    This will return the absolute path to to your myApp/WEB-INF/classes directory.

    0 讨论(0)
提交回复
热议问题