my web project root directory create a folder inside a txt file , just started using the java code directly manipulate the file right, but deploy to tomcat inside, how display file does not exist , ah, ; I put the output file path , this document shows how to go to the tomcat bin folder , and ask how to change this to run ah.
File urlFile=new File("nutch/seed.txt");
System.out.println("得到文件的位置"+urlFile.getAbsolutePath());
if (urlFile.exists() && urlFile.canRead()) {
try {
urls = FileUtils.readLines(urlFile);
} catch (IOException e) {
e.printStackTrace();
}
}
------ Solution ------------------------------------- -------
- File require absolute path , starting position bin;
------ Solution ------------------ --------------------------
directly in the background testing and deployment to get the relative path in tomcat different ah.
you put the items deleted deploy , redeploy the next , as well as a path way you get a look of what is to get the absolute path or relative path
I use a relative path in my project following a document without prior deploy to tomcat with the project directly using relative paths to access , deploy to tomcat , it can not be visited. The address is in the output bin to go inside.
inside your deployment project under the path of reform , change the path you want to visit you this path out of the question
------ For reference only ---------- -----------------------------
first top , seeking god
------ For reference only ---------------------------------------
seems WebRooT following things will be deployed to Tomcat in the right
------ For reference only ------------------------------- --------
/ nutch / seed.txt so try
------ For reference only ----------------- ----------------------
facie tomcat configuration error did not , logically speaking there is nothing wrong , it should be under webapps ah
you look at your deployment project is not in the webapps
------ For reference only ---------------------- -----------------
web file stream start tomcat Road King is the bin file pieces . You can use a relative path .. / Webapps / project name / after the write path to upload your
------ For reference only ----------------- ----------------------
web project that is in the java class as a relative path to access the file in the root directory is the bin file directory ?
------ For reference only -------------------------------------- -
directly in the background testing and deployment to get the relative path in tomcat different ah.
------ For reference only -------------------------------------- -
directly in the background testing and deployment to get the relative path in tomcat different ah.
------ For reference only -------------------------------------- -
directly in the background testing and deployment to get the relative path in tomcat different ah.
you put the items deleted deploy , redeploy the next , as well as a path way you get a look of what is to get the absolute path or relative path
------ For reference only - -------------------------------------
directly in the background testing and deployment to get the relative path in tomcat different ah.
you put the items deleted deploy , redeploy the next , as well as a path way you get a look of what is to get the absolute path or relative path
I use a relative path in my project following a document without prior deploy to tomcat with the project directly using relative paths to access , deploy to tomcat , it can not be visited. The address is in the output bin to go inside.
------ For reference only -------------------------------------- -
two ways to write code that is not the same path .
没有评论:
发表评论