Sponsored Content
Top Forums Shell Programming and Scripting Executing java .jar from UNIX script Post 302948918 by pankajkargeti12 on Saturday 4th of July 2015 07:44:08 AM
Old 07-04-2015
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 it is placed in the directory where the .jar is present


Code:
#!/bin/sh
###########################################################################
# runNCRUserReport.sh
# Author: Pankaj Kargeti
# Creation Date: JUNE 2015
###########################################################################
cd /cdunix/IQNavigator/userreport
BASEDIR=/cdunix/IQNavigator/userreport
LOGFILE=$BASEDIR/reports/runNCRUserReport.log
REPORTDIR=/cdunix/IQNavigator/wrk
FILENAME=NCR_users
#NCRUserReport.jar
echo "`date` start">>$LOGFILE

# Java variables
javabindir=/usr/java6/bin
jvm=${javabindir}/java
export jvm

#CLASSPATH=$ECLIPSE_IMPORTERS_HOME:$ECLIPSE_IMPORTERS_PROPERTIES
CLASSPATH=${CLASSPATH}:$BASEDIR/NCRUserReport.jar
CLASSPATH=${CLASSPATH}:$BASEDIR/poi-3.5-beta6-20090227.jar
CLASSPATH=${CLASSPATH}:$BASEDIR/ojdbc14.jar

export CLASSPATH

# Set PATH
PATH=$PATH:${javabindir}
export PATH

$jvm -Xmx1024m -Xms256m org.dev.excel.util.Int2TextUtility "$REPORTDIR" "$FILENAME"|tee -a $LOGFILE

echo "End of Generate Report `date` end">>$LOGFILE
exit


Last edited by Scrutinizer; 07-04-2015 at 10:57 AM.. Reason: CODE tags
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

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... (1 Reply)
Discussion started by: CJ Walt
1 Replies

2. UNIX for Dummies Questions & Answers

java.lang.System when running jar

Hello, I recieve the following error when trying to run the following command in a ksh. The operating system is AIX5.1. /usr/bin/jar -xvf {filename}.zip Can't find class java.lang.System But when I run it on the command line it unzips the file fine. Does anybody know why this... (2 Replies)
Discussion started by: ctcuser
2 Replies

3. UNIX for Advanced & Expert Users

Executing a .dll from a Unix script

Is it possible for a Unix script to execute a .dll. If so, where would I find information/examples of how to do that? Thanks, in advance, for any help. :rolleyes: (2 Replies)
Discussion started by: BCarlson
2 Replies

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

5. Programming

JAVA - External JAR files in UNIX

Hi, I have to run my JAVA programs in UNIX server. The java program uses some external jar files for compiling. I have set the classpath to the folder where all the jar files are present using EXPORT classpath command. But when i compile, it shows errors.. saying that the classes relating... (8 Replies)
Discussion started by: satish2712
8 Replies

6. UNIX for Advanced & Expert Users

Executing a shell script from windows;script present in unix

I need to execute a shell script kept in unix machine from windows. User id, password area available. For eg. There's a shell script wich moves all the logs kept in my home directory to a directory named LOGS. Now i need to get this done through windows; either using a batch file, or java... (4 Replies)
Discussion started by: rajneesh_kapoor
4 Replies

7. Shell Programming and Scripting

Executing the shell script through java program

Hi Team, Can you pls advise in java how can we call a shell script, actly I have a shell script at the following location /opt/dd/ajh.sh now I can execute this script by opening the session through putty by entering the servers details and password and then navigating to the following... (2 Replies)
Discussion started by: punpun777777
2 Replies

8. Shell Programming and Scripting

Compiling and Executing a Java File With a Shell Script

I'm trying to use a shell script to compile and execute a java file. The java classes are using sockets, so there is a client.java file and a server.java file, each with their own shell script. I also want to handle the command line arguments within the shell script, not the java classes. The... (1 Reply)
Discussion started by: britty4
1 Replies

9. UNIX for Advanced & Expert Users

Executing of UNIX script using email

Dear Unix Leads, can you please let me know is it possible to execute a shell script in UNIX machine sending an email from outlook or gmail ? or is it possible to generate a token file in UNIX by sending email which we can indirectly use to trigger script your response on this is highly... (5 Replies)
Discussion started by: mirwasim
5 Replies
REBUILD-JAR-REPOSI(1)						Java Packages Tools					     REBUILD-JAR-REPOSI(1)

NAME
rebuild-jar-repository - rebuild a JAR repository SYNOPSIS
rebuild-jar-repository [OPTION]... DIRECTORY DESCRIPTION
Rebuild a jar repository (built by build-jar-repository) based on the current JVM settings OPTIONS
If no option is specified the default action will be to rebuild with symbolic links -c, --copy Copy files. -h, --hard Create hard links. -s, --soft, --symbolic Create symbolic links (default). EXAMPLES
rebuild-jar-repository . - This will update all links created by build-jar-repository in the current working directory. Updated links will be symbolic links. rebuild-jar-repository -h /tmp - This will update all links created by build-jar-repository in the /tmp directory. Updated links will be hard links. AUTHOR
Written by the JPackage Project (http://www.jpackage.org/). REPORTING BUGS
Bugs should be reported through Red Hat Bugzilla at http://bugzilla.redhat.com/. SEE ALSO
build-jar-repository(1), build-classpath(1), JAVAPACKAGES
06/10/2014 REBUILD-JAR-REPOSI(1)
All times are GMT -4. The time now is 09:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy