linux 1 « Development « Java I/O Q&A





1. linux to compile multiple java file    stackoverflow.com

here is my directory structure. /user/a /user/b /user/b inside folder a,b,c there is a file person.java (it is the Same file, just a one line modification. now, on my shell, im on my /user/ directory and ...

2. Java Application Hang on Linux at "java.io.UnixFileSystem.getBooleanAttributes0"    stackoverflow.com

Our customers application seems to hang with the following stack trace:

  java.lang.Thread.State: RUNNABLE
    at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
    at java.io.UnixFileSystem.getBooleanAttributes(Unknown Source)
    at java.io.File.isFile(Unknown ...

3. Cross-platform way to open a file using Java 1.5    stackoverflow.com

I'm using Java 1.5 and I'd like to launch the associated application to open the file. I know that Java 1.6 introduced the Desktop API, but I need a ...

4. Create directory with write permissions for the group    stackoverflow.com

I create a folder in my java program (running on linux) with mkdirs() function of File object. The problem is that the folder gets only read permissions for the group. I ...

5. How to "walk around" in the File System with Java    stackoverflow.com

I'd like to do a search for folders/directories from java, and go into those folders/directories in java. I guess it's called system utilities? Any tutorials out there, or books on the ...

6. How do I open 20000 clients in Java without increasing file limit?    stackoverflow.com

Whenever I open a socket channel. If the client accepts then 1 file descriptor is created internally so I can create a maximum of 1024 clients in Linux.
But I want ...

7. Create AppleDouble formatted file in Linux    stackoverflow.com

I'm working on an application that syncs data. For Mac OS, files are uploaded and if they contain resource fork information, the fork is read and stored as a string using: ...

8. How to get the present working directory on linux in java    stackoverflow.com

I am invoking the command using a bash shell in linux. This command completes its operation using java class. I want to retrieve the present working directory from where the command ...

9. Converting a .so file to a .jnilib file    stackoverflow.com

I've got a .so library compiled for Linux under the ELF format, which is being used by a Java program. I'm trying to port this application to Mac OS X, and ...





10. File paths in Java (Linux)    stackoverflow.com

I have created a Java application that loads some configurations from a file conf.properties which is placed in src/ folder. When I run this application on Windows, it works perfectly. However when ...

11. java process is frozen(?) on linux    stackoverflow.com

all.
This is my first question on S.O.
I have a very odd problem.
Below is my problem... I write very simple method that write some text to a file.
Of course it works ...

12. Java Charset problem on linux    stackoverflow.com

problem: I have a string containing special characters which i convert to bytes and vice versa..the conversion works properly on windows but on linux the special character is not converted properly.the ...

13. Are there libraries or packages for creating .mobi files in a Java/Linux environment?    stackoverflow.com

I'm trying to find a solution that offers either a Java api for writing .mobi files for sending to a Kindle, or something that's scriptable given a Linux environment. I ...

14. Java File.isDirectory() returns False for a Directory in Linux    stackoverflow.com

Please see code snippet:

File[] additionalFiles = new File(FILE_PATH).listFiles();
boolean isDirectory = file.isDirectory();
I have verified that the directory path is correct, and when I run the code on Windows, the value of isDirectory ...

15. Generate cab files on Linux    stackoverflow.com

I'm looking for a stanadlone application, script or library (better Java) to generate cab files on Linux.

16. Too many open files in one of my java routine    stackoverflow.com

I have a multithreaded code that has to generated a set of objects and write them to a file. When I run it I sometime get "Too many open files" message ...





17. Java 1.7ea: Files.probeContentType(path) returns null    stackoverflow.com

I'm having a bit of a strange problem with an application using the Files.probeContentType(path)-method to test for file type: On both my Ubuntu and Fedora systems, it works fine, but when ...

18. Monitor file in Java on Linux 64bits    stackoverflow.com

I'd like to be notified when a file has been created, deleted or changed, but not using polling mechanism. I have surveyed related Java API that can use.(EX:JNotify, JPathWatch and JXFileWatcher) Those APIs ...

19. Do commands run from current directory in a shell script?    stackoverflow.com

In a bash shell script I tried these two versions:

java -jar abc.jar&
and
CMD="java -jar abc.jar&"
$CMD
The first verison works, and the second version complains that abc.jar cannot be found. Why?

20. ANT Execute failed: java.io.IOException: Cannot run program "cp ": java.io.IOException: error=2, No such file or directory    stackoverflow.com

I'm trying to use ANT to copy files from one directory to another directory on Linux. Firstly I used copy task, it works fine but the file mode is not preserved. Then I ...

21. Recommended solutions to use PGP-compatible file encryption from a Java app running on Linux?    stackoverflow.com

I need to replace an existing application that, among other things, will need to encrypt/decrypt/sign messages and files in a manner compatible with PGP Desktop. The new application is written in Java ...

22. Are there any Java libraries for adjusting IO scheduler priority on linux    stackoverflow.com

I have a Java program running on a linux system, which I would like to give a higher IO Scheduler priority. Is there a library JNI/JNA based that would allow ...

23. linux tool to list all functions in a source file?    stackoverflow.com

I am looking for a command line utility on *nix, that can dump the names of all the functions, classes etc. defined in a file(C/C++/Java)

24. linux command for extracting war file    stackoverflow.com

i have centOS on my VPS and i upload myproject.war file to the tomcat application server (/webapp folder). how can i extract the .war file with linux command prompt? i'm using puTTy.

25. which directory should I checkout our java project files into for a team build    stackoverflow.com

we use svn(subversion) for our source repository. On the same box, we build our project PLUS deploy it onto an appserver. All the team members(under 10, in number) will login to ...

26. Java I/O vs. Java new I/O (NIO) with Linux NPTL    stackoverflow.com

My webservers use the usual Java I/O with thread per connection mechanism. Nowadays, they are getting on their knees with increased user (long polling connection). However, the connections are mostly idle. ...

27. How to move files from one drive to another drive in java    stackoverflow.com

I am trying to move a file using java, from one folder to another folder, however the folders are on different hard drives, which fails to work with the renameTo method. ...

28. Java + Linux: Working Directory is my home folder    stackoverflow.com

A lot of people have the problem that when they start from nautilus a JAR-application, that the CWD (Current Working Directory) is set to their home folder (and not the folder ...

29. Debian 5.0 dosen`t see java excecutable file    stackoverflow.com

How its possible? ls -la|grep java -rwxr-xr-x 1 root root 47308 ??? 15 11:41 java -rwxr-xr-x 1 root root 47936 ??? 15 11:41 javac -rwxr-xr-x 1 root root ...

30. Using linux script, how to add or replace package statement in java source files    stackoverflow.com

I have many Java source files which I need to change their package line with a custom one depending on the current directory structure. Some of these files don't have ...

31. Reading a remote file with java on linux    stackoverflow.com

I need to read a remote file using a java app, but the file is in apache server on linux. I tried with "\\" but doesn't work like windows. How can i do ...

32. Can we read an object serialized in .NET in a linux machine?    stackoverflow.com

I need to transfer some files written in serialized form as files in a windows machine (C#.NET serialization) to a linux machine. How can I achieve this? I need to use ...

33. copy file from one location to another location in linux using java program    stackoverflow.com

Using JSP am trying to move customer logo into another location in linux but its not working. thanks in advance Here is my program

String customerLogo = request.getParameter("uploadCustomerLogo").trim();

StringBuffer absoluteFolderPath = new StringBuffer();

absoluteFolderPath.append("/zoniac");

absoluteFolderPath.append("/Companies/");

absoluteFolderPath.append("companyCode/");

absoluteFolderPath.append("custom/");

String destination = ...

34. How to change a file that used to be a directory back to directory on linux?    stackoverflow.com

I was playing around with Apache VFS API to move files back and forth between my local machine and remote linux host over sftp and it converted some directories to files ...

35. g++: File not found    stackoverflow.com

I have been developing a program lately that compiles and runs a C++ Program from a Java program, I have gotten everything working basically (or atleast to my knowledge) but then ...

36. Compiling java file from different directory    stackoverflow.com

I am very new to JAVA. I have written simple program (in Linux -VIM editor), compiled and executed it, everything is fine. Now,I have moved that file to a different directory and ...

37. How to fix java when if refused to open a file with special charater in filename?    stackoverflow.com

How to open a file, with a special character which Java refused to open? At the beginning I guess it was a charset encoding problem as I read the filename wrong from ...

38. JAVA can invoke the .so file on linux platform?    stackoverflow.com

I want to invoke the API provided by a ".so" file in a JAVA project. Can JAVA call the .so file on linux platform? Anyone could provide a solution? ...

39. [Linux]Load .so file for JNI results in: java.lang.UnsatisfiedLinkError: no libdebug in java.library.path    stackoverflow.com

I need some native C++ code to be called within my Java application so I use 'System.loadLibrary(String)' to load the required .so file, but when I try to execute the Java ...

40. Java writing file on Linux which gets deleted but i can still write to it    stackoverflow.com

I have a Java application which is writing files to disk. The issue is, Linux does not lock files as Windows does, so someone can delete the file as it ...

41. Java Process IO    stackoverflow.com

Im using java to start a GNOME terminal process in linux and redirecting its input and output to my code. Below is a code.

        ...

42. Java, Linux: how to detect whether two java.io.Files refer to the same physical file    stackoverflow.com

I'm looking for an efficient way to detect whether two java.io.Files refer to the same physical file. According to the docs, File.equals() should do the job:

Tests this abstract pathname ...

43. Java read a logfile live    stackoverflow.com

I'm writing a cod4 server controller in Java(I know there are perfectly fine server controllers out there, but I want to learn from it). Now I want to take specific actions ...

44. Create a file using Runtime.exec?    stackoverflow.com

I'm having trouble using Runtime.exec in Java, it seems some commands work while others do not. For example if I run

echo some data > data.txt
In my terminal it works fine, ...

45. Is it possible to simulate a file creation exception in Java on Linux?    stackoverflow.com

I had a simple test to make sure that an ant task was behaving properly, and so put in illegal file characters for windows and linux like so:

@Test(expected=BuildException.class)
public void destinationDirectoryCreationException() throws ...

46. How to make file sparse?    stackoverflow.com

If I have a big file containing many zeros, how can i efficiently make it a sparse file? Is the only possibility to read the whole file (including all zeroes, which may ...

47. howto find specific java source file responsible for output string from many possibilities    stackoverflow.com

I have been experimenting with someone else's java program, which is spread over many directories, and .java source files. When I run the program on the command line (Linux), it works ...

48. Why this javac: File Not Found error?    stackoverflow.com

Working with some basic java apps on CentOS 5 linux and I have my classpath set to point to home/pathToJava/bin which contains javac and java and I have .java files in home/pathToFolderA/src and ...

49. preferences-systems tries to write a lock file at a location where "normal" users have no write permissions on Linux    stackoverflow.com

I am using system prefrences for testing my code i observed some peculiar things on java 1.5

private void loadEmptyPreferences() throws IOException,
         ...

50. Find directory for "application data" on linux and macintosh    stackoverflow.com

I have a game engine based on LWJGL, and to run it I need to place the required native libraries onto the user's computer. On Windows, I do so by finding ...

51. Runtime.exec() - pass file to open in linux, it finds app    stackoverflow.com

If my java app is running under Windows I can call Runtime.getRuntime().exec ("rundll32 SHELL32.DLL,ShellExec_RunDLL " + filename); and pass the file to be opened. Windows will then find the correct app ...

52. My java process's file descriptors going "bad" and I have no idea why    stackoverflow.com

I have a java webapp, built with Lucene, and I keep getting various "file already closed" exceptions - depending on which Directory implementation I use. I've been able to get ...

53. File Move throws IOException due to different mount volume in Linux    stackoverflow.com

Hi my java program has to move the files to a folder which is in different mounted folder. I want to treat it as a normal folder path and move the file ...

54. IOException Adventure    stackoverflow.com

I have my java process(in my system) trying to talk to a shellscript(details1.sh),which is in /tmp dir of a remote system(of course the 2 systems are connected). But i am getting ...

55. How to Run sh file from java in linux as background process    stackoverflow.com

I need to run Sh file from java class.In that java main class is from main class it calls another sh file it takes data from db writes to csv file.It ...

56. How do I execute an executable file from within a java file on linux?    stackoverflow.com

I am trying to execute an executable file and a perl script from within a java program. I have found many topics similar to this but most of them refer to ...

57. Accessing "~" (user home) from Java in Linux    stackoverflow.com

I need to create a configuration file in ~/.config/myapp.cfg So I am doing this with File:

File f;
f = new File("~/.config/gfgd.gfgdf");
if(!f.exists()){
    f.createNewFile();
}
The problem is, that it tell me, that ...

58. Any sure fire way to check file existence on Linux NFS?    stackoverflow.com

I am working on a Java program that requires to check the existence of files. Well, simple enough, the code make use calls to File.exists() for checking file existence. And the problem ...

59. Java: Watching a Directory for Changes    stackoverflow.com

I want to create a listener to detect directory change recursively (the main directory and its subdirectories). After a web search I found this link that explains the use ...

60. Inherting parent folder permissions in new java-created files    stackoverflow.com

I hava a java application, that creates files and folders somewhere on the customer machines. i need that the new files and folders will get the same permissions as their parent folder, ...

61. Java. Save file as root in Linux    stackoverflow.com

How I can save file generated by java application in folder with root access?

62. How to write RAW data to a file using Java? e.g same as: nc -l 8000 > capture.raw    stackoverflow.com

In TCP i am receiving media stream from an IP camera as RAW. According to there advise, i need to write that as file. And then i can play it with ...

63. Java AsynchronousFileChannel with lots of open file handlers in Linux    stackoverflow.com

My understanding of asynch file I/O might be wrong but I am trying to use the latest JDK 7's AsynchronousFileChannel to speed up an application with an unexpected worse result. The ...

64. rundll32 equivalent for opening and viewing files in linux platforms    stackoverflow.com

is there any equivalent for rundll32 in unix platforms through which we can view files???Also i want to know the code by which we can open and view the files(similar to ...

65. Seeing too many lsof can't identify protocol    stackoverflow.com


I have a Java process/app. When I run /usr/sbin/lsof -p on that java process, I see a lot of "can't identify protocol". Also, interestingly, File descriptors(FDs) are increasing at a ...

66. Loading a Linux .so File at Java Runtime    stackoverflow.com

I'm trying to load a linux .so file at runtime in Java, but I'm getting an UnsatisfiedLinkError. I'm passing in the -Djava.library.path=/Users/tom/codebase/jni/dist VM argument when running the below java main ...

67. Wrap linux filter in java    stackoverflow.com

I want to write a JUnit test that assures that our self-implemented XML canonicalization works just like "xmllint --c14n".

    ProcessBuilder pb = new ProcessBuilder("xmllint", "--c14n", "-");
   ...

68. Sorting BIG file based on two columns    stackoverflow.com

I have a big file that can't fit in the memory which I would like to sort. The file consists of two columns and multiple records. The first column is numerical ...

69. How do I guarantee that my file tails the latest buffers from Linux cache    stackoverflow.com

The problem is that I want to guarantee that my file tailing will almost never do disk I/O. As the files (log files, essentially) are being written to the disk by the ...

70. exec a java program under linux    coderanch.com

Hello, I want to run java program in a java program. When i do this : Process p = Runtime.getRuntime().exec(jav); try{ p.waitFor();} catch(InterruptedException ire){} InputStream is = p.getErrorStream(); BufferedReader br =new BufferedReader(new InputStreamReader(is)); while(br.readLine() != null) { agl.console.append(br.readLine()); } } catch(IOException ioe){} where jav="java prog" It works under windows but not under linux, i don't understand. Can anybody helps me ? ...

71. help needed:parallel port in linux    coderanch.com

hi all, i was wondering if any one can help me with my problem . i am using a linux system with J9 VM running on it . for developement i am using IBM's visual age micro edition 1.4. now i want to access serial and parrallel ports and do a bit of communication using these , for serial i have ...

72. cannot open parallel port in linux    coderanch.com

hi all, i am trying to read and write data to /from the parallel port , i am running j9 vm on linux.under /dev there are lp0..lp3 parport0..parport3, and port devices , i dont know which one to use , i have tried all , they all return with an ioexception saying "cannot find the file" except for port device which ...

73. Different behaviour of getInputStream() of Runtime.exec() with Linux & NT    coderanch.com

Hi friends I'm facing a strange problem,,, as im starting a process thru Runtime.exec(),which return me this Process object ,this process is a server which takes some time to start completely ,now im getting this process input stream thru process.getInputStream() after using Thread.sleep(x)so that my process can be started completely , This works nice on linux(means it gives me complete inputstream) ...

74. device read under linux    coderanch.com

We make custom hardware and we have a singleboard PC built in with our hardware. We have had a device driver built to talk to our side of the hardware. The driver guy was wondering if we could actually use the file I/O (or maybe channels) functions under java to access the info provided by the driver instead of haveing to ...

75. Creating a file with proper permissions in linux - URGENT    coderanch.com

Hi all, Is there anyway using merely java.io or java.nio apis to create a new file with proper permissions for user, group and others? If not, how can I do it with Linux system calls? (I know creat might help, but I am not sure how to pass the permissions stuff it). Any help appreciated. Thanks, Payam.

76. process execution in linux    coderanch.com

Hi Guys, I have got a problem with executing process from java. I want to open a shell from java and execute a command. It is easy in this way Process application = Runtime.getRuntime().exec("konsole "); But I use a special shell (trigo shell) which can not take commands in this way. I have to open it and type the command. Can ...

77. Copy file from window machine to Linux machine using Java.io.*    coderanch.com

I am trying to copy a file from Linux machine to window machine by using java.io.*. I don't see any exceptions in logs, but the file just didn't get copied to the destination. The application is running on Linux machine, the destination folder on windows is shared with everyone with full control. Can someone give me some ideas how I can ...

78. List all Linux mounted volumes    coderanch.com

That is because on a unix type system all mounted volumes still fall under root somewhere, so there is only one "root". To get the mounted volumes you can use the command df -k in Runtime.exec (you may wish to use df -lk so that nfs mounted volumes where the nfs server is not responding does not cause the command to ...

79. org.apache.xml.serialize - problem in linux    coderanch.com

Hi all, i'm trying to generate a xml from a oodbms to make a pdf by jasperreport..... everythinks is working fine!! under windows!! :-( .. but when i try to update the real site that i have in linux its giveme an error..... i'm using a server in Fedora core 4, the webserver is Jetty, the error its when is trying ...

80. How do we take free bytes from the Linux file system ?    coderanch.com

Hello, We are doing File System Simulation in Linux.We want to simulate the "i-node" or "index node" .....We want our inode to be exactly the way it is in Linux ......We will be storing the addresses of the file contents(data blocks) in our inode .....For this, we want the command which will give us the address of free blocks in Linux.In ...

82. how exactly can i make out if a file in linux has just been updated or has been replaced.    coderanch.com

Hello, I have a text file called 'test'. There is a perl script which randomly populates the text file with some records. A java program is scheduled to read the new data from the text file. perl-->textfile-->java program There are cases when there is a burst of records in the textfile. If the text file has more than 10k records it ...

83. run linux command in java    coderanch.com

Hello guys! I want to capture the output from the linux console. More precisely i want to capture the mac and the address from the /sbin/ifconfig -a command. I have made a method but it doesn`t work. static String getInputMode() { String mode = null; try { String[] cmd = {"xterm -e /sbin/ifconfig -a"}; Process p = Runtime.getRuntime().exec(cmd); BufferedReader br = ...

84. Shared objects in linux    coderanch.com

You have 2 write two shared object files. suppose 1.so and 2.so each hv 2 functions f1(char*) and f2(). Write a main prog such dat it takes 2 arguments say '1' & '2'. In this case the 1.so must get linked dynamically and call f1 (char*) - which is present in 1.so file (coz '1' is da first parameter) and '2' ...

86. can java generate .so files for linux?    coderanch.com

88. Special characters while writing file in linux env    coderanch.com

Hi, I have an application running in Linux environment. This modules reads the below string and writes in a new file. XYZZZABDS.$ABDCJDDMDLGDMG However, while writing using the below line, I am getting the out put as below. XYZZZABDS.$ABDCJDDMDLGDMG Due to this my application throws an exception. Please suggest me if there is any turn around or suggestions to resolve this issue. ...

89. Japanese Character Encoding Issues on Linux    coderanch.com

Hi, I am receiving a file from an external system. The file name has some japanese characters. So when I tried to rename that file by prefixing the date, the out put file contains only date_???.txt. The japanese characters get converted to ?. I want to retain those character in Linux environment. It work fine in windows environment. Regards, Sanjay

90. Linux - javac: file not found    forums.oracle.com

So after wrestling with setting the links and path up, I finally got it recognizing javac all over the place. I made a simple text file to see if it worked, and "javac blah.java" brings up a file not found error. I tried creating it first in the main folder, it didn't work there. I then tried creating it in the ...

91. how to output executable Bin file under linux from java    forums.oracle.com

Hi im beginner in java under linux and i want to out put my java programs to be bin files that can run if this not possilble how to run the output jar files with just double click ? does i have to run sh file that do the hob how? thanks in advance.

92. A way to convert path file from Linux to window?    forums.oracle.com

Thank flownder for your help my file has two paths. the last path from database under Linux path with "/" and the first path is from computer. If it is Linux, I will enter /home/balalal/ for the first path and then add this path with the last path from database. Everything fine. If the computer is Window, I need to change ...

93. What is the command for on linux    forums.oracle.com

You can just bookmark the root page of the javadocs. That's the easiest thing. I can imagine that it might be useful to use something like this with find and grep, for example. You could recursively grep though all the javadocs for a particular term and then just invoke the html page on the command line to view it in a ...

94. opening windows-1252 named files on Linux    forums.oracle.com

?? tests: is a Directory ?? Classical - Wagner- In the Hall of the Mountain King.mp3: is a File Name: Classical - Wagner- In the Hall of the Mountain King.mp3 Parent: ../../tests Path: ../../tests/Classical - Wagner- In the Hall of the Mountain King.mp3 Absolute Path: /home/offtopic/workspace/filelist/../../tests/Classical - Wagner- In the Hall of the Mountain King.mp3 Canonical path: /home/offtopic/tests/Classical - Wagner- In ...

95. Compiling multiple files in linux    forums.oracle.com

Hello, I am trying to compile and create a Makefile. But first, I am trying to compile my java program. I originally created my program on a Windows Netbeans environment. Now I am trying to use Linux to make it work. I downloaded the Java SDK and am able to use say on the terminal Javac Main.java and it will compile ...

96. Reading Latin1 encoded filename under Linux    forums.oracle.com

For historical reasons file names in UNIX environments are basically null-terminated streams of bytes, interpreted any way the user wants them to. That means that unlike the nice Java world, it doesn't have a defined interpetation, i.e. no mapping from byte-value(s) -> unicode codepoint. So generally file names will be interpreted acording to your locale. If you specify your locale as ...

97. Archiving File on Shared Folder in Linux using java code    forums.oracle.com

I have a requirement wherein I have to ftp a file (Feed.txt) from windows FTP server to Linux machine1 and archive the same file (with timestamp suffixed on file name like Feed.txt_22April) on Linux Machine2. I am trying to achieve this through java code. I am able to ftp the file(Feed.txt) from windows ftp server to Linux machine1 /opt/ftproot directory and ...

98. Possible to get notification of directory change/file created in linux?    forums.oracle.com

Hi I am developing a peice of software that needs to be distributed in linux environment. One function of software is to detect directory change (changes incl. file creation/file saved/ deletion etc) I can do this in Windows env with Java + JNI but im no sure if its possible in Linux as im not sure how Linux file system architecture ...

99. "java.io.IOException: Too many open files" in LinuX    forums.oracle.com

Hi Developers, * I am continiously running and processing more than 2000 XML files by using SAX and DOM..... * My process is as follows, - Converting the XML file as Document object by DOM.... - And that DOM will be used while creating log file report, that log file will be created after executing all XML files.. * After processing ...

100. Question about multi-jar pacaking, linux bin file.    forums.oracle.com

I notice that as one builds a java program, one tends to refer to other jar file libraries. However, the jar format won't let these jars be within one large jar, for deployment. -What is the Sun java way, without using onejar or jjar, of acheiving this? -Failing that option, how does one build a *.bin file for linux execution, such ...