command linux in java code


 
Thread Tools Search this Thread
Top Forums Programming command linux in java code
# 1  
Old 04-28-2012
command linux in java code

Hello

Quote:
String cmd="touch {1..10}";
Process process = Runtime.getRuntime().exec(cmd);
process.waitFor();

InputStream is = process.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
while(true) {
String line = br.readLine();
if(line == null) break;
System.out.println(line);

}

Please why the files have not created?


Thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

JAVA code to create file in Linux with specific permission

Hi All, I'm looking for JAVA code to create file in Linux with specific permission File should be created and saved in Linux in this path \opt\sys\doc by Java with this permission 764 Anyone can help to provide this Java code (3 Replies)
Discussion started by: AbuAliiiiiiiiii
3 Replies

2. Linux

Linux through Java code

Hi How can I write a Java program to execute Linux commands? What is the best approach: Invoking the Linux shell within Java and executing commands or, using the Java APIs to do the stuff. Since it is platform independent, it'll know itself what to do. We need not check which OS the Java... (1 Reply)
Discussion started by: Dorothy
1 Replies

3. Programming

Running a Java program on Linux

Hello, I have a project directory in /home/researcher I have in my project/src three packages:A (contains the main class), B and C and I have 2 jar-files file1.jar file2.jar files in the project/my-jars In Class A I import other classes from the other packages I compiled as follows:... (4 Replies)
Discussion started by: chercheur857
4 Replies

4. Shell Programming and Scripting

Block of code replacement in Java source code through Unix script

Hi, I want to remove the following code from Source files (or replace the code with empty.) from all the source files in given directory. finally { if (null != hibernateSession && hibernateSession.isOpen()) { //hibernateSession.close(); } } It would be great if the script has... (2 Replies)
Discussion started by: hareeshram
2 Replies

5. Programming

can i have an optimal solution for this java code ? Facing Java heap space problem even at 3GB heaps

My desired output is run: for this 1 for this 2 for this 3 for this 4 for this 5 for this 1,2 1->2 for this 2,3 2->3 for this 3,4 3->4 for this 4,5 4->5 for this 1,2,3 1->2,3 (2 Replies)
Discussion started by: vaibhavkorde
2 Replies

6. Android

Android is Linux (and Java)

In case you did not know, Android 2.1, Éclair, runs on the 2.6.29 Linux kernel. However, the user space it is built atop Dalvik, a Google-designed custom JVM (Java virtual machine). This is pretty interesting, when you think about it. The core of Android is the linux kernel, and the standard... (5 Replies)
Discussion started by: Neo
5 Replies

7. UNIX for Advanced & Expert Users

Tuning Java on LINUX

Hi, Need help in tuning JAVA on LINUX. From http://www.trutek.com/index.php?id=173 I understand that on Linux operating system with 4GB memory, JVM can be run with maximum memory of 3800m. But I had no luck. Could someone help me in achieving on Red Hat Linux server. Here is the details of... (5 Replies)
Discussion started by: crabbie_upk
5 Replies

8. UNIX for Dummies Questions & Answers

Linux Programming in JAvA

is it advisible to do Linux Programming in JAVA.. If so, whats the advantage over C++ or C.. Cud anyone also help me out by providing some links in this regard.. Would be highly appreciated.. (1 Reply)
Discussion started by: srikumar_cs
1 Replies

9. UNIX for Dummies Questions & Answers

Java in Linux

DOes any1 know if the java.awt and javax.swing packages are installed in Redhat Linux 9.0 or not??. I have compiled a simple Java program and ran it but the Java programs related to GUI are not working. Can any1 provide some Help?. (4 Replies)
Discussion started by: rahulrathod
4 Replies
Login or Register to Ask a Question
shmctl(2)							System Calls Manual							 shmctl(2)

NAME
shmctl() - shared memory control operations SYNOPSIS
DESCRIPTION
The system call provides a variety of shared memory control operations as specified by the cmd argument. cmd can have the following val- ues: Place the current value of each member of the data structure associated with shmid into the structure pointed to by buf. The contents of this structure are defined in glossary(9). Set the value of the following members of the data structure associated with shmid to the corresponding value found in the structure pointed to by buf: shm_perm.uid shm_perm.gid shm_perm.mode /* only low 9 bits */ This cmd can only be executed by a process that has an effective user ID equal to either that of a user having appro- priate privileges or to the value of either or in the data structure associated with shmid. This cmd cannot be executed on a shared memory segment that has been created with relaxed isolation. Remove the shared memory identifier specified by shmid from the system and destroy the shared memory segment and data structure associated with it. If the segment is attached to one or more processes, then the segment key is changed to and the segment is marked removed. The segment disappears when the last attached process detaches it. This cmd can only be executed by a process that has an effec- tive user ID equal to either that of a user with appropriate privileges or to the value of either or in the data structure associated with shmid. Lock the shared memory segment specified by shmid in memory. This cmd can only be executed by a process that either has an effective user ID equal to that of a user having appropriate privileges or has an effective user ID equal to the value of either or in the data structure associated with shmid and has the privilege (see getprivgrp(2)). Unlock the shared memory segment specified by shmid. This cmd can only be executed by a process that either has an effective user ID equal to a user having appro- priate privileges or has an effective user ID equal to the value of either or in the data structure associated with shmid and has the privilege (see getprivgrp(2)). RETURN VALUE
returns the following values: Successful completion. Failure. is set to indicate the error. ERRORS
If fails, is set to one of the following values. cmd is equal to and Read operation permission is denied to the calling process (see in glossary(9)). buf points to an illegal address. The reliable detection of this error is implementation dependent. cmd is equal to and the shared-memory segment specified by shmid is not locked in memory. shmid is not a valid shared memory identifier. cmd is not a valid command, or the command contains invalid parameters. cmd is equal to and there is not sufficient lockable memory to fill the request. cmd is equal to The attached process count of a shared memory object is too large for the field in the data structure provided by the application. Recompile the application with the latest file to resolve this issue. cmd is equal to or and the effective user ID of the calling process is not equal to that of a user having appropriate privileges and it is not equal to the value of either or in the data structure associated with shmid. cmd is equal to and the shared memory segment has cmd is equal to or and the effective user ID of the calling process is not equal to that of a user having appropriate privileges and the calling process does not have the privilege (see getprivgrp(2)). EXAMPLES
The following call to locks in memory the shared memory segment represented by This example assumes the process has a valid shmid, which can be obtained by calling shmget(2). The following call to removes the shared memory segment represented by This example assumes the process has a valid shmid, which can be obtained by calling (see shmget(2). AUTHOR
was developed by AT&T and HP. SEE ALSO
ipcrm(1), ipcs(1), shmget(2), shmop(2), stdipc(3C), privileges(5), STANDARDS CONFORMANCE
shmctl(2)