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 eclipse) and in .class file(in tomcat inside myapp/WEB-INF/classname/packagename/). My deployment is in tomcat.
try {
functionNamesObject.Integration(
".txt",
path+"\\CopyFolder",
path+"\\RunFolder",
"app.exe",
"Input.txt"
);
I want path to be dynamic when I call above function. I tried with getResource("MyClass.class") ,new File("").getAbsolutePath(); and System.getProperty("user.dir") but no use. Is there any other way?
CopyFolderwon't exist by default on an installation. You will need to create it manually. As such you will know where you create it, so hard code it into your app.webapps/application) or theWEB-INFfolder of your deployed app?webapps/application)getServletContext.getRealPath("")in your servlet.