How to pass the environment name while calling java program from unix script?

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: "+ System.getProperty("consumerEnv"));

This is the code I'm using to call the java program from my unix script:

java -Xms64m -Xmx256m -Djava.library.path=$MY_CLASSPATH -cp $MY_CLASSPATH <<class-name>> -DconsumerEnv=$consumerEnv

I have verified that the value of $consumerEnv is coming as DEV.

Can anyone please help?
Thanks in advance.

try this

 
java -Xms64m -Xmx256m -Djava.library.path=$MY_CLASSPATH -cp $MY_CLASSPATH <<class-name>> -DconsumerEnv="$consumerEnv"

Try this,

java -Xms64m -Xmx256m -Djava.library.path="$MY_CLASSPATH" -cp "$MY_CLASSPATH" <<class-name>> -DconsumerEnv="$consumerEnv"

try this inside the script which may solve ur problem :

DconsumerEnv="$consumerEnv" 
export $DconsumerEnv  

java -Xms64m -Xmx256m -Djava.library.path="$MY_CLASSPATH" -cp "$MY_CLASSPATH" <<class-name

Still no luck :confused:
I tried this:

java -Xms64m -Xmx256m -Djava.library.path=$MY_CLASSPATH -cp $MY_CLASSPATH <class name> -DconsumerEnv="$consumerEnv"
export $DconsumerEnv

---------- Post updated 01-11-12 at 02:54 AM ---------- Previous update was 01-10-12 at 04:40 AM ----------

I found the resolution: :slight_smile:
swapping <<class-name>> & -DconsumerEnv will work.
See the corrected code below:

java -Xms64m -Xmx256m -Djava.library.path="$MY_CLASSPATH" -cp "$MY_CLASSPATH" -DconsumerEnv="$consumerEnv" <<class-name>>

Thanks everyone for helping!!!!!...:b: