I have an environment variable called $CLASSPATH
which I use as the java classpath to run a certain java code.
This $CLASSPATH
variable is quite long. Its size is about 66427 bytes (see how long it is)
Now this is the weird behaviour.
When I append a certain jar file (say bar.jar
) to the beginning of $CLASSPATH
, the jar file gets added to the classpath and my code runs fine.
I do this in a shell script as follows,
CLASSPATH=/home/foo/bar.jar:$CLASSPATH
But, when I append the bar.jar at the end of the $CLASSPATH
, my code gives an exception, due to missing the bar.jar
file!
CLASSPATH=$CLASSPATH:/home/foo/bar.jar
Why this weird behaviour?
Am I missing anything here?
Update:
If applicable, please have a look at the output generated from xargs --show-limits
command on shell.
foo@foo-laptop:~$ xargs --show-limits
Your environment variables take up 3632 bytes
POSIX upper limit on argument length (this system): 2091472
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 2087840
Size of command buffer we are actually using: 131072