unix « File Attribute « Java I/O Q&A





1. Unix stat()/lstat() for Java    stackoverflow.com

Suppose I want to get several of a file's properties (owner, size, permissions, times) as returned by the lstat() system call. One way to do this in Java is to ...

2. Pipe file disappears but still works    stackoverflow.com

I have 2 programs, both written in Java. The first launches several instances of the second and then communicates with them via pipe files. When running 2 instances of the program, ...

3. Touch a file using apache FileUtils    stackoverflow.com

I have looked at the source code of Apache Commons FileUtils.java class to see how they implement unix like touch functionality. But I wanted to confirm with the community here if ...

4. Solaris: Mounting a file system on an application's handlers    stackoverflow.com

When mounting an NFS filesystem, all data handling goes through the nfs client. How can I write my own handlers to use something other than NFS? An alternative would be a localhost ...

5. How to "tail -f" file from a remote Unix system in Java?    stackoverflow.com

I want to be able to get buffered input from a remote system (using SSH and username password encrytion from Java) and then "tail -f" a file, buffering the input. Is ...

6. Need File.isAbsolute() for platform independent application working with UNIX file system    stackoverflow.com

my Java application can run on all platforms. It is working with some remote files located on FTP server on Linux. To navigate on the FTP I use absolute paths like ...

7. Java library to create cabinet files on Unix?    stackoverflow.com

Is there a Java library to create cabinet files on Unix. I don't need any compression support. I just want to create a plain cab file using Java. Something similar to ...

8. How to get Unix file rights in Java    stackoverflow.com


Is there any way to read/set Unix rights for a file and check if process has user/group/other rights in Java? I know it's not a problem with JNI, but I ...

9. Java implementation of common unix file utilities like ls, cat, etc    stackoverflow.com

A similar question exists but the best answer seems to state there is no pure solution, but rather one needs to call the operating system. Why am i after such utilities, primarily ...





10. Mounting of file systems remotely    stackoverflow.com

  1. I have a unix machine (unix1) and another remotely connected unix machine (unix2). using sshfs i am able to mount a unix2 file system on the unix1 machine (of course, I ...

11. Connect to Unix File System using Java Program    stackoverflow.com

I want to establish a connection with my UNIX file system using java program.. So that I can make some File I/O operations and normally I can connect using Putty. How can ...

12. Need info on java.io.UnixFileSystem.rename0    stackoverflow.com

Could you please explain the below stack trace, I tried to understand the source code but couldn't enough information on what rename0() is doing.

"[STUCK] ExecuteThread: '0' for queue: ...

13. What is the difference between "./file" name and "../file name"    stackoverflow.com

actually I want to know What is the difference between "./file" name and "../file name" ?

14. Mounting a drive in unix through Java    coderanch.com

15. Unix I/O Sync    coderanch.com





17. How to call a UNIX script froma java application on AIX (using Korn shell)?    coderanch.com

Philip, Thanks a lot for the tip. Here's what I tried (almost similar to your tip) and it worked. import java.io.*; public class ExecScript { public static String Script; public static String Usage="java ExecScript script.name.path [arg0 arg1 ... argn]"; /** This method diplays the contents of the InputStream class passed to it as an argument. */ public static void displayOutput(InputStream is) ...

18. getting unix like file information the java way    coderanch.com

What I basically want, is to find out wheter the owner, group and others have read, write and exec permissions on a file as well as the owner/group of that file (or directory). So far I do not know if there is any way to do so in Java, so if there isnt, is there a way then to get the ...

19. File Creation Problem in unix    coderanch.com

in my code i am trying to write a file to the directory /home/bdb/store/ and i am creating a File f = new File("/home/dbd/store/"+filename); and giving it Outputstream .. but when i say private static String STOREDIR ="/home/bdb/store/"; File f = new File(STOREDIR,filename); i getting FileNotFoundException please can somebody show me the right way to give file paths in unix so ...

20. How to get the file reciving time from unix box    coderanch.com

I'm not exactly sure what you're asking, but you should be able to get the file's timestamp by calling the lastModified() method on the java.io.File object. So, like this: import java.io.File; ... File f = new File("somepath/somefile.txt"); if (f.exists()) { long timestamp = f.lastModified(); // do whatever with that long, like create a java.util.Date and go // from there... }

21. uncompressing .Z file in Unix    coderanch.com

I have written a program to uncompress a ".Z" file on Solaris. When I run it I get the following error: java.io.IOException: Not in GZIP format at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:129) at java.util.zip.GZIPInputStream.(GZIPInputStream.java:57) at java.util.zip.GZIPInputStream.(GZIPInputStream.java:67) at Log.main(Log.java:12) Here is the program: import java.util.zip.*; import java.io.*; class Log { public static void main(String[] args) { System.out.println("Hello Log!"); try { int BUFFER = 2048; FileOutputStream fos ...

22. Tailing a file on Unix    coderanch.com

I posted this before in a different group but got no reply so figured it may be harder than I thought. My system has a series of log files and what I want is to write a piece of java to tail the last 1000 lines which will then print onto the screen from the BufferedInputStream. I've got it working from ...

23. File.getName() in Unix    coderanch.com

hi all, Has anyone encountered any issue with getName() function of File class in UNIX environment ? In windows platform getName() returns the name of the file ("filename.txt"), but the same is returning me the entire path in unix ("c:\folder\filename.txt"). Please let me know if there is any direct approach to resolve this issue ? I'm planning to find the last ...

24. Decompress Unix compressed .z file    coderanch.com

25. Creating folers anf files in Unix using java    coderanch.com

Unix allows just about anything in file / folder names, including spaces and even other characters usually used by the shell. I even managed to create files that start with a -; it's a real trick trying to delete those I tell you, since rm thinks it's a flag for it. The trick is, on the shell you need to either ...

26. Using java to chmod files in Unix    coderanch.com

27. Java not recognizing UNIX secondary group    coderanch.com

I'm seeing the following problem and I think it is related to java bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4052517 I have a directory called test. the ownership of that directory belongs to the 'aa' group. I have a user junioradm whose primary group is 'adm' but is also a member of the 'aa' group. I'm executing a java program as the junioradm user. The program ...

28. Java Program for unix slect ()/poll()    coderanch.com

30. File IO on unix    forums.oracle.com

31. Unix File Permissions    forums.oracle.com

try { String command = "chmod 604 " + file.getAbsolutePath(); Runtime.getRuntime().exec(command); } catch (IOException ioe) { ioe.printStackTrace(); } } This seems to work ok. However, as well as changing the file permissions, the code also seems to be unintentionally changing the permissions on the working directory ('bin') to 604, rendering it unusable. Not good. Has anyone come across a similar problem? ...

32. File.exists() and accent on unix    forums.oracle.com

33. Unix and File IO    forums.oracle.com

34. How to open/read file using Java in Unix?    forums.oracle.com

36. how to get all (user-group-others) file permission of a unix file    forums.oracle.com

It is not clear to me what you are asking? If I understand you correctly, you want to tighten the restrictions on use of a directory beyond those provided by Unix. As far as I am aware, you cannot get information about the owner id or the group and world permissions from the File class so you are going to have ...