Mac Full Path For Fileinputstream Java

Mac Full Path For Fileinputstream Java Rating: 3,7/5 3952 votes

Hi all, I am having a hard time figuring this out. I have two applications running on different machines, one on Mac and another on Windows.

They both access / create files from a common file path resource. Now, my Mac machine allows to create folders and file names containing special characters, while Windows does not. The application where I am having the problem is running on Windows and it needs to read and delete the file created by Mac machine. So, the problem arises when the file path has special characters.

Some observations: I create a folder named ABC_? Which when I view from the Mac machine shows ABC_? As the folder name and when I view it from Windows machine, the folder name appears to be ABC_ I tried to make a FileInputStream object for a file inside the folder: FileInputStream fis = new FileInputStream( basePath + 'ABC_? MyImage.jpg'); // This gives me below Exception: java.io.FileNotFoundException: prod1 cust1 ABC_?

MyImage.jpg (The filename, directory name, or volume label syntax is incorrect) And trimming the special characters (as I viewed from Windows) had this response: FileInputStream fis = new FileInputStream( basePath + 'ABC_ myImage.jpg'); // This gives me below Exception: java.io.FileNotFoundException: prod1 cust1 ABC_ myImage.jpg (The system cannot find the path specified) All I want is to obtain the stream of the image kept at that location from an application running on Windows. The application is a simple Application, that runs always.

I'm on Java 6 and I have a method that scans the runtime classpath for a file called config.xml. If found, I would like to read the contents of the file into a string: InputStream istream = this. Convert a file path into a File object with an absolute path relative to a passed in root. Remove file information from a filename returning only its path component: 11.3.25. Remove path information from a filename returning only its file component: 11.3.26.

The user I am using, has access to the share. (The app can access a file / folder without any special character). No, it is not a service. It is a Process. I am working on fixing a bug where it fails to read only from the files which have incorrect syntax according to Windows. If you would be kind enough to read the Exception detail I posted twice, it says, 'The filename, directory name, or volume label syntax is incorrect' but that is the actual path for my file, just that I created it from Mac. Paul: No problem.

Fileinputstream java example

Bear: Thanks for reply. Reading the java docs (File class), I also have the opinion that characters which are allowed by the underlying platform can only be used for filenames. Probably that's why File class provides this method: public boolean canRead() Tests whether the application can read the file denoted by this abstract pathname. Also, I tried Samba Jcifs API (jcifs.smb.SmbFile), as it handles the file system generically, Windows or Unix, but it also failed to read from a folder with special characters, strengthening my opinion.

Popular games for mac air free download. Thanks all for your time.