Skip to content
Advertisement

How to pass system variable with normal variable to call java program in command line batch script

JavaScript

When i try to access 5th argument it shows:

JavaScript

It takes only arguments upto class name

Advertisement

Answer

Whatever given after main class runConsoltesting are main method arguments which are totally 4 (%4,%5,%6,%7). So you are getting ArrayOutOfBoundException when you try to access fifth element.

%1, %2 and %3 are JVM arguments and NOT java main method arguments. So these can be read in code as below.

System.getProperty(String property), here property is name of your -D argument.

For example, System.getProperty(“EPM_ORACLE_INSTANCE”) will return the value which is set for place of %1.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement