The commands you propose works because you set/changed environment
variables (PATH, JAVA_HOME). But for every other user (including system
users) these normally do not work (you could say that there is
/etc/environment but there is no policy forcing a program to use it).
In general, one reason
I disagree with the following statement:
It seems that you have installed your JDK to /opt/jdk manually.
Therefore it cannot and should not be detected by the package manager.
There are a number of ways to detect whether or not Java is available.
The easiest is:
echo $(java -version)
Others
There are some cases where other Java library dependencies exist (such
as Apache's Commons Logging). Installing these through a package manager
can introduce version conflicts. For example, if one program depends on
part of the logging API that was removed, then upgrading breaks older
programs.
pdftk does not use the installed java runtime directly by calling
'java', but links binary to the CNI (Cygnus Native Interface for
C++/Java Integration) which comes only with libgcj.
Some of the packages which pdftk seems to depend on are only (indirect)
recommends/suggestions from other