Executing UNIX command from java on NT


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Executing UNIX command from java on NT
# 1  
Old 06-25-2003
Question Executing UNIX command from java on NT

Hi - I am totally new to UNIX so please bear with me...
I run a java program on Win NT server to do file ftp to UNIX server.
I log in, cd, create ftp file on UNIX and quit from my java progam - all works well.

Now I want to execute a script on UNIX.
At the UNIX 'console'/'shell' (!?) you type in:
./test
for the script to execute.
If I send the command "./test" from my java program, I get an error: "command not understood". I am in the correct directory where the "test" script is; and commands like "user xxxx" and "pass yyyy", and "cwd /home/mydir/" works fine.

Any ideas?

Tx,
CJ
# 2  
Old 06-25-2003
You have connected via the ftp protocol. You can do "get" or "put". But all you can do is move files around. You cannot run remote scripts via ftp.

You need to get your java program to connect via ssh or telnet to get a shell prompt. Then you can run "./test".

And btw, "test" is not a great name. Unix has a "test" command.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to find IP of user machine executing a particular UNIX command?

Hello, Our applications are deployed in SunOS 5.10 servers. All the team members use a same username/pwd to login to the box. Very often we face issue were we could see that weblogic server instance are KILLED and we are not able to trace who executed kill command. All team members use PUTTY to... (2 Replies)
Discussion started by: santtarius
2 Replies

2. Shell Programming and Scripting

Executing java .jar from UNIX script

I have a .jar placed in my Unix directory. The .jar creates a .csv file .I want to execute the .jar and place the output file in a target Unix directory. The Unix Script is as follows. The issue that i am facing is that the file is not being placed in the REPORTDIR=/cdunix/IQNavigator/wrk instead... (4 Replies)
Discussion started by: pankajkargeti12
4 Replies

3. UNIX for Advanced & Expert Users

Error executing sqlcmd command through UNIX

Hi All, I am trying to execute a set of sql statements in sql server 2008 using the sqlcmd command in unix and passing the query in the "input" parameter. It is giving me an error "incorrect syntax near 2014". The below statement is giving an error : declare date_val datetime, ... (4 Replies)
Discussion started by: Rahul Raj
4 Replies

4. UNIX for Dummies Questions & Answers

running unix command from java

Hi All, I have been struggling for a week trying to run a unix command from my java program. the unix command is: ssh dmdev3@tsapid01-zt3d01 ':> /t3/envs/dmdev3/test/file_list.txt' when i try to run this command directly on my unix console, it works perfectly. but when i try it form... (12 Replies)
Discussion started by: madhu_sharan
12 Replies

5. UNIX for Advanced & Expert Users

running unix command from java

Hi All, I have been struggling for a week trying to run a unix command from my java program. the unix command is = ssh dmdev3@tsapid01-zt3d01 ':> /t3/envs/dmdev3/test/file_list.txt' when i try to run this command directly on my unix console, it works perfectly. but when i try it form my... (0 Replies)
Discussion started by: madhu_sharan
0 Replies

6. Shell Programming and Scripting

Executing a variable that strores a unix command string

Hi: I have a touble with executing a variable that stores a unix command string. The following would be excuted fine: command='ls -l' `echo $command` However, the following gives me an error: command='(uuencode file1 file1; uuencode file2 file2) | mailx email_id' `echo... (1 Reply)
Discussion started by: sagewise
1 Replies

7. UNIX for Advanced & Expert Users

Executing SQLPLUS in UNIX Script from JAVA

Hi ALL, I would like to execute one SQL query(ORACLE) in UNIX shell script. For this I used sqlplus in script and tested locally. It worked fine. But my requiremnt is to execute the script from Java. In this case the UNIX part is working but sqlplus is not returning anything The JAVA code used... (0 Replies)
Discussion started by: anooptech
0 Replies

8. UNIX for Dummies Questions & Answers

Executing a unix command

Hi, I need to execute the following unix command through my java code - zip -e When i execute this command from the command prompt, i am prompted for a password in the following manner - Enter password: Verify password: Is it possible to provide the password inthe first command itself... (5 Replies)
Discussion started by: jacob23
5 Replies

9. UNIX for Dummies Questions & Answers

executing the su command from a java program.

Say in unix (AIX) m/c, I am logged in with s1 user and want to start process p1 with user credentials of s2. I can do manually in this way: #su - s2 #enter password for s2> somePassword $ p1 But all this I have to do through a java program. How to pass the password through program. One... (1 Reply)
Discussion started by: shailendrat
1 Replies

10. Shell Programming and Scripting

execute command unix with java:possible or not?

hi everybody, i have a small unix script and i want to use it with java, so how can i executte unix command with java (if it is possible): in fact i want to use some values returned by this script with java swings. is it possible (of course everything is possible) but how can i do? thank you in... (4 Replies)
Discussion started by: mips
4 Replies
Login or Register to Ask a Question