• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Java windows Linus File path problem on exist() or isfile() method

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

i am using some pdf files need to be opened when user click the link in my web application.
so i need one validation like when no file there in the path the file corresponding name display without link so i use isFile() then exist() method

directory structures

student
web-inf
classes
filedir
some pdf files

so i use application.getContextpath+"//fildir//pdffilesname"

it is working in windows local but when i move this to linus staging is giving problem like the exist method return always false but the file i am able to open through link.
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Backward slashes won't work on UNIX, and I wouldn't count on doubled forward ones (why are you doing that?) to work either. Use File.separatorChar rather than a hard-coded separator. Also note that UNIX filesystems are case sensitive, while Windows ones aren't always; be sure to use correct letter case.
 
G.Sathish kumar
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ernest Friedman-Hill wrote:Backward slashes won't work on UNIX, and I wouldn't count on doubled forward ones (why are you doing that?) to work either. Use File.separatorChar rather than a hard-coded separator. Also note that UNIX filesystems are case sensitive, while Windows ones aren't always; be sure to use correct letter case.



i have done that but i am not clear with the concept.

when i access the file from web application context like http://sitename/filepath/file.pdf it is working in windows and not working in linux
but in the os context like //directory/file.pdf if i create the file it working both windows(corresponding file path d:/filpath/file.pdf) and linux

please explaing what is the difference why the web application context is not working in linux?

 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic