I have a Java web app deployed on Tomcat 6 on Ubuntu 9.04. For certain images, I want to create a symbolic link to another directory of images. This will allow me to reference images that remain on the server even if the application is removed and redeployed.
The application is deployed in the
/var/lib/tomcat6/webapps/ROOT/ directory and the
images directory exists in the war. When I deploy the application, I create a symbolic link to the
saved_images directory so there is a path like
In the application, I have the following code:
File file = new File("/var/lib/tomcat6/webapps/ROOT/images/saved_images/abc.jpg"); boolean fileExists = file.exists();
fileExists value is true when the code runs, but the images aren't displayed on the page when referenced like
The permissions of the images in the
/var/lib/tomcat6/webapps/ROOT/images/saved_images are the same (the owner and group is tomcat6, which is the same as the other files deployed in the war). If I remove the sym link and put the saved_images files in a directory of the same name, the images are displayed. How can I have the page display these images when the directory is a sym link without having to copy the files to a real directory?