Run the scripts from windows to UNIX

HI,

I have one java program in windows OS. From that java program, I want to run the shell script file in the UNIX OS. Is it possible ??If yes, please post me the source code, how to do that ??

Thanks,
Srinivas

Is this homework?
I will give you the benefit of doubt for now.

It is possible to do this, however you will need to take one of two approaches.

  1. Run the commands remotely using a telnet/rlogin/ssh api http://javassh.org for example, others are availabe on sourceforge.

  2. Have a server proccess written in java (in fact it could be written in any language) running on the unix machine and communicate with it using CORBA;RMI; or sockets.

Since method 2 is in now way trivial I suggest you look into using method 1, for you you will find many examples and FAQs by simply googling, for example this ssh\ api\ java - Google Search should get you started.

Write a script having export PATH,CLASSPATH (having jars used in java program) , JAVA_HOME ... etc in a file
and run it .....

First try on the command line and put those in shell script.

Is this what you want ...

export PATH=$PATH:remaining path
export CLASSPATH=$CLASSPATH:remaing jars path

java javaprogram

Hi bhargav,

no. I have one jsp which is there in the WAR. I want to deploy the war at windows OS. In jsp, calling one shell script file. Shell script file is there in UNIX OS. First, i need to connect UNIX server, then i need to run the shell script file. Then output will be stored in another file. I want to get the ouput in another JSP. I want this. Do u have any idea on this. If yes, please guide me how to do .

Thanx,

Srinivas