11-14-2001
Java program calling a UNIX command
I was wondering if it was possible to call a unix command directly from a Java program during run-time. This command could very very basic e.g. "ps -ef" returned as a string, all I need is a starting place so if anyone has any suggestion or examples I would be very grateful
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
2. UNIX for Dummies Questions & Answers
Having problem in connecting my gui java program to postgreaql database. I first used setenv classpath /home/share/postgresql/java/postgresql.jar:proj1, where proj1 is my folder conatining all java and class file, to set classpath. Then javac *.java. Then java proj1.Login. It gives me... (2 Replies)
Discussion started by: uci
2 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I need to execute a java program in a shell script.I then need to assign the value being returned by the program into a unix variable.Is there any way i can access the value in a variable in java program?
As in if my java code has a variable,
.
.
.
.
valueA =x.getValue()
.....
can... (1 Reply)
Discussion started by: inquisitive101
1 Replies
4. Shell Programming and Scripting
Hi All,
I need to call a java method from a shell script. I know we can use the command
java ClassName
to call the main method in it. But I need to call another method that is there in the class and pass an email to it.
Can I use
java ClassName.MethodName(email)
Any help will be... (4 Replies)
Discussion started by: RahulK
4 Replies
5. Homework & Coursework Questions
Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies
6. Shell Programming and Scripting
Hi,
I'm trying to test one unix shell script in dev environment. But I'm not sure how to pass the environment in my java program calling code. I'm trying to use -DconsumerEnv="DEV" but unfortunately I get 'null' while trying to print the value from java class.
System.out.println("Environment: "+... (4 Replies)
Discussion started by: Pramit
4 Replies
7. Shell Programming and Scripting
Hi All,
well , i am facing this problem.. i have tried a few sample codes but there isn't any solution . could anyone please give a sample code as of how to do this...
Please see the below details...and read the details carefully.
I have written some code, logic is
1)from... (4 Replies)
Discussion started by: aish11
4 Replies
8. Shell Programming and Scripting
Hi,
We are having a java server which can run on command line and once initiated, it will prompt options to enter from 0 to 5. The java program kickoff respective operation once number is entered between 0 to 5. However i want to always enter "1" and write another shell program wrapper to start... (4 Replies)
Discussion started by: surya5kn
4 Replies
9. UNIX for Dummies Questions & Answers
Hi ..
I have created a sql macro, i want to execute this through ksh in putty.ie) sql.ksh will contain the macro query ,once i call this ksh ,the macro should trigger.
I am able to write a macro : for ex:
create macro macro_name
(sel * from db_tablename)
execute macro_name.
Could... (1 Reply)
Discussion started by: Kalaiselvi66
1 Replies
10. Shell Programming and Scripting
Hi I am trying to implement one program, where JAVA needs to trigger the backend UNIX script. Tried with options like
String cmdArray = {"/bin/ksh","-c","/SCRIPT_ABSOLUTE_PATH/sampleScript.ksh /FILE_ABSOLUTE_PATH Test_File.dat TEST E SFTP"}
When I trigger the script from front end with... (1 Reply)
Discussion started by: karumudi7
1 Replies
LEARN ABOUT OPENSOLARIS
run
run(1F) FMLI Commands run(1F)
NAME
run - run an executable
SYNOPSIS
run [-s] [-e] [-n] [-t string] program
DESCRIPTION
The run command runs program, using the PATH variable to find it. By default, when program has completed, the user is prompted (Press ENTER
to continue:), before being returned to FMLI. The argument program is a system executable followed by its options (if any).
OPTIONS
The following options are supported:
-e If -e is specified, the user is prompted before returning to FMLI only if there is an error condition
-n If -n is specified, the user is never prompted before returning to FMLI (useful for programs like vi, in which the user must do
some specific action to exit in the first place).
-s The -s option means "silent", implying that the screen does not have to be repainted when program has completed. The -s option
should only be used when program does not write to the terminal. In addition, when -s is used, program cannot be interrupted,
even if it recognizes interrupts.
-tstring If -t is specified, string is the name this process has in the pop-up menu generated by the frm-list command.
EXAMPLES
Example 1 Sample Output of the run Command
Here is a menu that uses run:
menu="Edit special System files"
name="Password file"
action=`run -e vi /etc/passwd`
name="Group file"
action=`run -e vi /etc/group`
name="My .profile"
action=`run -n vi $HOME/.profile`
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
attributes(5)
SunOS 5.11 7 Nov 2005 run(1F)