• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Shell script

 
anirban dando
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 20828
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
anirban dando
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Henry.. It worked out .. U saved my day .
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic