aspose file tools*
The moose likes Java in General and the fly likes Shell script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Shell script" Watch "Shell script" New topic
Author

Shell script

anirban dando
Greenhorn

Joined: May 12, 2005
Posts: 4
Hi-
I am trying to execute a shell script with path set to Java 1.3 and classapth set to some custom java classes. After runing the script the command java -version is showing that I am at version 1.1.8 which is the default one and also the classpath is not set. Where am I going worng ?? .. Interestingly the script is showing as Java 1.3 when I queried PATH in the script. Please check my script below -

#!/bin/ksh
export PATH="/usr/java131/bin:$PATH"
#export PATH
java -version

when the script is run --

> path.sh


java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1)
Classic VM (build 1.3.1, J2RE 1.3.1 IBM AIX build ca131ifx-20040721a SR7P (JIT enabled: jitc))
/usr/jdk_base/lib/classes.zip:/db2dev0/db2mqsi/sqllib/function:/db2dev0/db2mqsi/sqllib/java/db2java.zip:/db2dev0/db2mqsi/sqllib/java/runtime.zip:.

Where Am I doing wrong ?? .. Please help me ..

Thx,
Dando
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18120
    
  39

Shellscripts are executed in a subshell -- so you did change it, but the changes does not take.

It has been years since I used ksh, but for csh or bash, the "source" or "." command will run the script with the current shell.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
anirban dando
Greenhorn

Joined: May 12, 2005
Posts: 4
Thanks a lot Henry.. It worked out .. U saved my day .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Shell script
 
Similar Threads
error in eclipse
jdk1.3.0_02 PATH????????????
PATH and CLASSPATH
How to uninstall / override previous Maven version on OS X Leopard?
j2ee install 1.3.1 on dapper