Sponsored Content
Top Forums Shell Programming and Scripting How to capture return value from java in shell scripting Post 302348965 by TonyFullerMalv on Sunday 30th of August 2009 02:30:14 PM
Old 08-30-2009
If running:
Code:
ret_value=`java com.sample.Demo arg1 arg2`

Does not work then you could get the java script to save its output to a temporary file and then get the shell script to read in the contents of the file:
Code:
VARIABLE=`cat /tmp/temporary_file`

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture carriage return.

I try to test the carriage return in a variable. $ LENGTH=`expr $VARIABLE : ".*"` will return the length of the variable. But this doesn't work if $VARIABLE has zero length. Any help will be well appreciated. Thanks in advance. Giovanni (4 Replies)
Discussion started by: gio123bg
4 Replies

2. Shell Programming and Scripting

Capture Oracle return code in shell script

I am using the following code in my shell script list=`sqlplus -s $user/$pwd@$dbms<<EOF WHENEVER SQLERROR EXIT SQL.SQLCODE set pagesize 0 feedback off verify off heading off echo off select * from control_tbl where src_nm=$3 and extrct_nm=$4; exit SQL.SQLCODE; EOF` ERROR=$?... (1 Reply)
Discussion started by: Vikas Sood
1 Replies

3. UNIX for Dummies Questions & Answers

how to capture the return value in master script?

Hi, Here is my program that is returning a DATE: #! /usr/bin/ksh db=tcore_dev1 bteq <<end .logon $password_core .export report file=$BTEQ_OUTPUT_FILE_$$ select cast(add_months(cast(substr(cast(max(closedate) as varchar(10)),1,8)||'01' as Date),1)-1 as timestamp(0)) from $db.repo... (2 Replies)
Discussion started by: mahek_bedi
2 Replies

4. Shell Programming and Scripting

capture ftp return code..PLZ HELP

Hi all, i have written a code to ftp a file from one server to other.The ftp is happeneing successfully,but i am not able to capture the return code,to check if ftp has failed. plz help me to find out the return code....this is urgent below is the code i have written... (3 Replies)
Discussion started by: anju
3 Replies

5. Shell Programming and Scripting

reading fixed length flat file and calling java code using shell scripting

I am new to shell scripting and I have to to the following I have a flat file with storename(lenth 20) , emailaddress(lenth 40), location(15). There is NO delimiters in that file. Like the following str00001.txt StoreName emailaddress location... (3 Replies)
Discussion started by: willywilly
3 Replies

6. Shell Programming and Scripting

PID Capture and Return Codes

I have a process that copies files from a main storage server to main other servers. We are attempting to speed up the processing and have thought that the best method would be to use concurrent file copying. What was suggested is that we change from using a simple RCP and waiting for it to... (3 Replies)
Discussion started by: dorrellg
3 Replies

7. Shell Programming and Scripting

Shell Scripting Function call return value

Hi I have a function : Make_Report() { trx_report=`sqlplus -s $conn_str << @@ set echo off; set pages 0; set feedback off; set verify off; select srv_trx_s_no,... (1 Reply)
Discussion started by: neeraj617
1 Replies

8. Shell Programming and Scripting

How to capture script return code?

Hi I am executing database backup via shell script (Korn). The backup log is long, but I would like to capture only the last line so I can send an email if it fails Example of failed backup (only last 3 lines) BR0056I End of database backup: bejbofoh.aff 2012-07-26 07.31.21 BR0280I... (7 Replies)
Discussion started by: nimo
7 Replies

9. Shell Programming and Scripting

Shell Scripting | Return list of unique characters in files

Hi, I am trying to script the below, but I am not very good at it :( Your help would be greatly appreciated. 1. read all files in the directory in strings strings *.* 2. in each file, for each line that contains "ABCD", store characters located at position 521 and 522 of this line... (9 Replies)
Discussion started by: clippertm
9 Replies

10. Shell Programming and Scripting

To check if the JAVA Program is successfully executed in sh shell scripting

Hi , I have written a shell script to call a java program say load_id.sh .This sh script indeed is executed implicitly in other sh script which calls 2 more sh scripts one by one. I need to check if the load_id.sh (which calls java program) is executed successfully only then continue with... (1 Reply)
Discussion started by: preema
1 Replies
JAVA-WRAPPERS(7)						   Java wrappers						  JAVA-WRAPPERS(7)

NAME
java-wrappers - capacities shared by java wrapper scripts DESCRIPTION
Most Java programs are not run directly, but through small shell scripts that take care of various things, such as finding a suitable java environment and looking for libraries. To ease the task of the maintainers, they rely on a library providing runtime detection, library detection and other features. This manual page describes the common features of all those scripts, and to which point you can configure them. This is mainly done via environment variables. ENVIRONMENT VARIABLES
java-wrappers understands some environment variables: JAVA_CMD The java command that will be run. If this variable is set, it disables all lookup for a java runtime. JAVA_BINDIR Specifies a directory that will be looked for a java or a jdb executable (depending on the setting of JAVA_DEBUGGER). It has prece- dence over JAVA_HOME but not over JAVA_CMD. JAVA_HOME A path to a java runtime. If this variable is set, all lookup for a java runtime is disabled, except that if no java executable is found in the path, the command java is used. JAVA_FLAVOR A probably more easy-to-use version of the JAVA_HOME variable: instead of specifying the full path of the java runtime, you name it. List of available flavors can be found in the file /usr/lib/java-wrappers/jvm-list.sh. See examples below. JAVA_DEBUGGER If this is set, the wrapper will try to pick up a java debugger rather than a java interpreter. This will fail if the jbd of the runtime found is a stub. JAVA_CLASSPATH Additional classpath, will have priority over the one found by the wrapper. JAVA_ARGS Additional arguments to the java command. They will come before all other arguments. FORCE_CLASSPATH If this variable is set, it will be the only classpath. You'd better know what you are doing. DEBUG_WRAPPER This is probably the most important variable; if it set, the wrapper will print out useful information as it goes by its business, such as which runtime it did find, and which command is run eventually. JAVA_JARPATH The path where the wrappers will go looking for jar archives. If not set, the wrapper will look into the default directory, /usr/share/java. Warning : the wrapper will not look anywhere else than in JAVA_JARPATH. Setting it incorrectly will most probably result in early crashes. EXAMPLES
The examples all rely on rasterizer(1), from the package libbatik-java, but they really apply to all scripts that use java-wrappers. Print out debugging information: DEBUG_WRAPPER=1 rasterizer Limit rasterizer's memory to 80 MB: JAVA_ARGS=-Xmx80m rasterizer Force rasterizer to run with kaffe(1): JAVA_HOME=/usr/lib/kaffe rasterizer The same, but using JAVA_BINDIR: JAVA_BINDIR=/usr/lib/kaffe/bin rasterizer Force rasterizer to run with openjdk: JAVA_FLAVOR=openjdk rasterizer Debug rasterizer with Sun's debugger, while printing debugging information from the wrapper: DEBUG_WRAPPER=1 JAVA_CMD=/usr/lib/jvm/java-6-sun/bin/jdb rasterizer BUGS
Care has been taken to make the wrappers bug-free. If that was not the case, please file a bug report against the java-wrappers package. If you wish to submit any problem with a java executable relying on java-wrappers, please also submit the output of the command run with DEBUG_WRAPPER=1. It will save one mail exchange and therefore potentially reduce the time it takes to fix the bug. DEVELOPERS
There is currently no documentation about writing a wrapper script save the comments in /usr/lib/java-wrappers/java-wrappers.sh. If you have to write one, we suggest you base yourself upon, for instance, the rasterizer wrapper script, or any other one (just pick up any direct reverse dependency of java-wrappers and look for scripts). SEE ALSO
java(1), jdb(1) /usr/lib/java-wrappers/java-wrappers.sh AUTHOR
java-wrappers and its documentation were written by Vincent Fourmond <fourmond@debian.org> Version 0.1.16 2010-05-04 JAVA-WRAPPERS(7)
All times are GMT -4. The time now is 06:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy