Run the scripts from windows to UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Run the scripts from windows to UNIX
# 1  
Old 03-28-2005
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
# 2  
Old 03-28-2005
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 http://www.google.com/search?hl=en&q=ssh+api+java&meta= should get you started.
# 3  
Old 03-29-2005
Quote:
Originally Posted by srinivas peyyal
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

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 ...

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

java javaprogram

# 4  
Old 03-29-2005
Quote:
Originally Posted by bhargav
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 ...

Code:
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to run UNIX commands on remote machine from windows?

Hi All, I am working in support and we are planning to automate a system to reduce the direct manual intervention to core system. Please find the below details. 1. we have a web application that runs on Windows Platform. 2. From web application, we need to connect to remote Unix machine.... (6 Replies)
Discussion started by: Balaji K
6 Replies

2. Shell Programming and Scripting

run oracle procedure in unix scripts

for j in $(du -h $1| awk '{printf("%100-s \n",$2)}') do for a in $(ls -time $(find $j -name '*.txt') | awk '{printf("\n%s %s %s %s %s",$4,$7,$8,$10,$11)}') do echo "$a">output.txt done done exit 0 echo "Password : xxxxxx " > LOG/BGH_$3.out (0 Replies)
Discussion started by: utoptas
0 Replies

3. UNIX for Dummies Questions & Answers

How to run UNIX commands for practice in Windows 2000 OS?

How to run UNIX commands for practice in Windows 2000 OS? If you suggest to install Cygwin, please let me know the procedure to install, or else I feel happy if you suggest any stand alone app for running UNIX commands..:) (2 Replies)
Discussion started by: Srikanthk
2 Replies

4. Windows & DOS: Issues & Discussions

Windows services for unix - How do I run in batch

I just installed Windows Services for Unix. I want to create a ksh program and schedule it using the Windows scheduler. How would I go about doing it? What would the command line look like? Do I always have to be in a ksh shell to run the batch program even if it is not scheduled? ... (3 Replies)
Discussion started by: rbdenham
3 Replies

5. UNIX for Dummies Questions & Answers

Can I run unix in the same partition with windows?

Can I run unix in the same partition with windows xp? Because I have one for now.. Thank you for answers. (2 Replies)
Discussion started by: olddays
2 Replies

6. UNIX for Dummies Questions & Answers

How can I run scripts in my unix account from batch file in Windows?

Hi all, I'm working on Windows, connecting to my Unix account by different ways: by FTP opening files in UltraEdit32, by mapping drive to browse, by Exceed or Telnet to compile at Unix account. Actually, that is what I would like to change: I'd like to make a batch file which would connect to... (7 Replies)
Discussion started by: olgafb
7 Replies

7. Linux

Possible ways to run shell scripts on Windows

Hi all, I want to know possible ways to exceute the shell scripts on Windows environment. Please help me. Regards, Uday. (2 Replies)
Discussion started by: uday123
2 Replies

8. Shell Programming and Scripting

FTP Shell Scripts from Windows to Unix: files have exotic characters

Hey guys, I am working on my shell scripts in wordpad in windows. Then, I upload it to my unix using psftp, but when I open those files with "vi" in Unix, there are all these "^M" characters in the file. Would anyone of you have a clue as to why? Help would be appreciated. Thanks, Laud (4 Replies)
Discussion started by: Laud12345
4 Replies

9. UNIX for Advanced & Expert Users

Porting of Windows written unix scripts to unix platform

Can anybody help me in finding out a solution for the problem below? When we write .unix or .sh files in windows OS and port them to Unix platforms there is a character ^M inserted at the end of each line of the script file. During ftp porting I set the transfer mode as ASCII for the script... (7 Replies)
Discussion started by: tamilselvi
7 Replies

10. Windows & DOS: Issues & Discussions

How do you run Unix on top of Windows?

Okay, so here's my dealio. I have a (rather old) system that runs Windows 98 Second Edition. What i wanna do is be able to run Unix from it. My question is, how do you do that? A friend told me that when you boot up, the computer will ask you which OS you want to run. I'm really not quite clear on... (3 Replies)
Discussion started by: DarkAngel
3 Replies
Login or Register to Ask a Question