Java - pdftk/bootchart dilemma

Discussion in 'all things UNIX' started by Ocky, Dec 18, 2009.

Thread Status:
Not open for further replies.
  1. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,677
    Location:
    George, S.Africa
    I love pdftk in Hardy http://www.dedoimedo.com/computers/pdftk.html but in Karmic 9.10 it is a large 60+MB download due to the openjdk dependency.

    I don't need openjdk as I have the latest sun-java-jre (_17). Unfortunately the developers are not going to ever update the old and unpatched sun-java6-jre (_15) inthe repo. and, as far as I know, as from this Karmic release and in the future ONLY openjdk will be available.

    As pdftk now depends on openjdk I suppose I could not simply remove openjdk and get pdftk to use sun-java instead.

    BTW. Same situation with bootchart in Karmic.

    There were problems in the past with openjdk and the advice was 'always use Sun's java'
    If anyone has 100% success with openjdk please tell.

    An alternative that I could use instead of pdftk is pdfsam which has a GUI and can be used for merging and splitting pdf's.
     
  2. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,696
    You could download and install sun java and then set the LD_LIBRARY_PATH to point to where sun java is installed first. Might work ... not sure if all the libraries used by either of the two are identical.
    Mrk
     
  3. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,331
    Location:
    West Yorkshire, UK
    6.16 is in Lucid, not sure if 6.17 will make it in or not. Also worth checking to see if any patches have been backported.
     
  4. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,677
    Location:
    George, S.Africa
    Once again something new I haven't done before :argh: Do you mean something like this ?

    export LD_LIBRARY_PATH=/opt/java/jre1.6.0_17
    pdftk

    Actually I would rather refrain from experimenting - (No VB yet in my Karmic) - for obvious reasons :)

    I was hoping that I could install the openjdk version alongside sun-java and then simply do a sudo update-alternatives --config java and select the sun _17 version. Do you think that might work ?
    If not then I will just have to make do with OpenOffice and Gimp and forego merging pdf's. (and posting any bootcharts)

    Pdfsam looks quite nice but also needs openjdk. http://www.pdfsam.org/mediawiki/index.php?title=Main_Page
     
  5. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,696
    Yes, that's it. I would first check if there's anything under library path (echo it) to see what gives. Should be clean. So yes, that's it. Try that.

    Another option is to keep a dummy open java dir and symlink to sun java, but again, not sure if all the libraries are compatible. Try it - in VB!

    Mrk
     
  6. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,677
    Location:
    George, S.Africa
    Thanks. While all this advice helps my learning 'some Linux' tremendously, I am still a novice looking for the easy way out. In this connection I am pleased to advise that before trying the above, I have in the meantime found an excellent program called Pdf-Shuffler, which is python based and only 90 odd KB !
    Can merge/split/delete/shuffle pdf's and drag and drop into GUI from desktop. Sure it misses some of the great features of pdftk but I like it primarily for it's extreme ease of use and simplicity. Works a treat and it's in the repositories.
    Here's a screenshot.

    Screenshot-PDF-Shuffler.png
     
  7. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,677
    Location:
    George, S.Africa
    I decided to download pdftk (comes with openjdk) and all's well. I set Sun's java as default when I installed the binary several weeks ago, and it's still the default. pdftk works well - it must be using Sun's java I presume. Not ideal as I now have both openjdk and Sun's jre.
    (Can't uninstall openjdk as it will take pdftk with it).
    What the heck, at least I can do watermarks/stamps once again. Sshot.

    watermark.png
     
  8. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,696
    To know what java pdftk is using, first find where its binary sits:

    which pdtfk --> you'll get something like /usr/bin/pdftk

    Then, run ldd <binary>, like:

    ldd /usr/bin/pdftk

    And this will show you all the libraries its using, so you'll know if you're using openjdk or sun java.

    Mrk
     
  9. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,677
    Location:
    George, S.Africa
    Thanks. I should have thought to use ldd ...(stupid me :thumbd: ).
    Anyway, unfortunately it uses openjdk libraries judging by the output:-
    linux-vdso.so.1 => (0x00007fff977ff000)
    itext-2.1.5.jar.so => /usr/lib/gcj/itext-2.1.5.jar.so (0x00007f8f36d77000)
    libgcj.so.10 => /usr/lib/libgcj.so.10 (0x00007f8f33c16000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f8f33906000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f8f336ef000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f8f334d3000)
    libc.so.6 => /lib/libc.so.6 (0x00007f8f33164000)
    libm.so.6 => /lib/libm.so.6 (0x00007f8f32ee0000)
    librt.so.1 => /lib/librt.so.1 (0x00007f8f32cd8000)
    libz.so.1 => /lib/libz.so.1 (0x00007f8f32ac1000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f8f328bd000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f8f37684000)

    Will just keep both versions for now.
     
  10. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,696
    You can now use debian commands to see which package provides the libraries. I don't remember the exact flags, but in rpm, you have --whatprovides. Something along those lines.
    Mrk
     
  11. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,677
    Location:
    George, S.Africa
    I have tried the depends and rdepends commands - see sshot. To me it looks like pdftk is 'hot-wired' to use openjdk despite Sun's jre being set as default. I hope my conclusion based on the sshot is valid. :doubt:

    pdftk depends.png
     
  12. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,696
    Seems so ... now test machine, remove openjdk, install sun and see what happens. See if pdftk continues to work.
    Mrk
     
  13. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,677
    Location:
    George, S.Africa
    Done that, but as mentioned before, removing openjdk takes pdftk with it. Reinstalling pdftk even from Ubuntu's site (not Synaptic) also installs openjdk again.
    Not to worry. I am OK - my browsers are all using Sun's jre, and pdftk is happy with openjdk. No probs. no conflicts.
    Your advice always appreciated. :)
     
  14. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,331
    Location:
    West Yorkshire, UK
    I can't see any references to openjdk in that screenshot ?!?
    jdk stands for java development kit and that looks like some java compiler libs, sun also has jdl libs.
    All openjdk stuff is packaged as openjdk* in Deb/untu.

    :)
     
  15. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,677
    Location:
    George, S.Africa
    Yes understood, but I installed Sun's jre to /opt/java/ so I thought it would be contained there as it were, hence my deduction that only openjdk's install is responsible for that package.

    Edit: I have a lot to learn - just checked and gcj-4.4-jdk is not installed at all, so would mean back to square one - but some other time seeing all is working well.

    Thanks for the guidelines. :thumb:
     
    Last edited: Dec 20, 2009
Thread Status:
Not open for further replies.