PATH is used for executables only. It's what the shell (bash usually on MacOSX) uses for lookups for executables when you don't give an explicit path (such as /usr/bin/java or ./java).
Once you run java, now java is loaded, and it needs to figure out where things are. The shell is done. So, does java itself have any environment vars to check that might help? In general, you may try CLASSPATH. This gives a list of jars, to search for classes that may not be in the normal places java looks for.
But in this case, I don't think it could help, based on your syntax. You're telling it a specific path to a Jarfile. I'd just explicity path the jar out. Probably use a script to do this for you instead of typing this all out. I see something like:
sudo java -jar /path/to/yuicompressor.jar
in your future.