Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how do i print parameters in shell script through java

833473Apr 18 2011 — edited Apr 18 2011
Hi,

I am sorry if have posted this query in wrong thread!!!

How do i print the parameter in shell script which are passed from java programm?

i have tried in different ways.. but the actual param value is not printing when i execute the java programm


java code is here
import java.io.IOException;
public class TestShell {
	/**
	 * @param args
	 */
 public static void main(String[] args) {
	    String inputFilePath=args[0];
		String inputFileName=args[1];
		String outputFileName=args[2];
		String outputFilePath=args[3];
		Runtime r = Runtime.getRuntime();
		String[] cmdArray = new String[]{"Test.sh",inputFilePath, inputFileName, outputFileName, outputFilePath};
		try {
			r.exec(cmdArray);
			System.out.println("Test.sh executed successfully.");
		} catch (IOException e) {
			e.printStackTrace();
		}	
	}

}
I need a shell script to print paramenters (inputFilePath, inputFileName, outputFileName, outputFilePath)

Thanks,
Jasmin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 16 2011
Added on Apr 18 2011
7 comments
269 views