Ruby on Rails, programming, and SEO
Check out my articles about Ruby on Rails, programming, and SEO. Weekly updates? Subscribe to my feed.

Clipboard java applet

Source code for posting an image from the clipboard using a java applet.

Update: Also try SUPA, which is a great ready-to-use alternative.

The source code my previous post about a clipboard image applet is now available here:

The code lets you post images from your clipboard directly to the webserver to avoid the need to go through Photoshop or another image application.

When you compile your own applet using javac, you’ll need to sign it in order to be able to get access to the clipboard. (I have signed the applet contained in the zip and the certificate expires 6 months from July 19th, 2009, around January 19th, 2010).

If you find it useful or somebody else has already done this (and somebody surely has, but I didn’t have any luck finding it on Google), please write me in the comments.

- Lasse

Related posts

Tags: , , ,


  1. [...] Update: The source code for this demo is now available here. [...]

  2. Terry Riegel says:


    Awesome little applet. I saw your demo looks very cool. However when I tried it in Safari and Firefox on my Mac it said “Image Not Found” each time. I used the screengrab shortcust to get my image.


    I use this all the time in Mail and iChat and would like to get it working in Safari with my web site It looks like you are onto something with this.

  3. Lasse Bunk says:

    Hi Terry,

    That’s because it only saves the image to the desktop.
    Try opening the picture in Preview, click Command+A, Command+C and then try using the applet again. Then it should work.

    BR, Lasse

  4. Terry Riegel says:


    The procudeure you outlined does work correctly, but…

    The CONTROL-CLICK does not save the image to the desktop. It stores the image in the clipboard. If I click w/o the CONTROL key it would save it to the desktop.

    So it seems the applet likes the data it finds from a copy within preview, but it doesn;t like the data it finds from a screen grab copy.

    Any ideas why. Could the message be more descriptive about the data it is finding in the clipboard?



  5. Terry Riegel says:

    Hello again,

    I was able to get it working on everything except IE8 (GRRRRRRR!!!! can’t stand IE). I get something like this…

  6. Terry Riegel says:

    Also, one more bit of info that might be useful.

    If I use preview and select all, then copy the paste works. If I take a screen grab from my clipboard, paste into TextEdit then copy from TextEdit it give the “Image Not Found” Error.

  7. Lasse Bunk says:

    Hmm, that’s pretty weird. I also tried the CTRL-click one, and it didn’t work for me either.

    Also, I don’t know why it’s not working in IE8, but maybe someone could figure that out?

  8. Pete says:

    Look good but I don’t understand this much…. where is the source for shoot.php? Also, why was the applet source changed from the original code as it should have done a similar thing (why was this bit was all commented out and also the bit about POSTing as multipart data

    “–”+boundary+”\r\n “+
    “Content-Disposition: form-data; name=\”img\”; filename=\”filename\”\r\n”+
    “Content-Type: image/jpeg\r\n “+
    “Content-Transfer-Encoding: base64\r\n\r\n” +

  9. Travis says:

    Running Windows IIS server and Firefox, I cannot get this to work. Probably a file permissions issue but I’m not sure how to resolve? Your demo works for me.


  10. lassebunk says:

    @Pete: The source is available in the link Regarding why the source was modified from the original: I was not able to compile it using javac and was not able to get it working before i modified it. Regarding the code piece commented out: I changed it to get it working with shoot.php.

    @Travis: I have only tried it with Linux so I am not able to tell how to get it working on IIS – Sorry.

  11. ElTerrible says:

    I have the same problem like Travis. I’m trying to get it running on IIS and Firefox. It doesn’t work !!! :-(( Ideas?

  12. dcgamers says:

    Is there any possibility that this thing can work with PNG images? I like this applet but It spits out JPEG images, which are lacking on quality. PNG images would be better. I don’t know much about applets, maybe you can come out with a PNG version?

  13. lassebunk says:

    If anybody has a solution for outputting the clipboard as PNG (as needed by @dcgamers), please let us know in the comments.

  14. @lassebunk If you look at the sourc code, it shows that he is uing a JPEG encoder to create the JPEG. You could just as easily change the code to use the PNG encoder. If you wanted to take it even further, you could make it configurable via the UI, listing a set of radio buttons as inputs for which image format you desired, altering the interface to support those parameters.

  15. Jon says:

    I am not able to get the Applet to work in IE (7) with your demo (same error Terry got, line 15). I could have sworn it worked a few days ago when I first tested it. Could it be because the signature expired? It works fine in Firefox.

  16. Lewpen says:

    This is the best thing ever! Thank you :)

  17. Internet Explorer 8 have been my most used browser this year, it is definitely stable and fast loading too. ~

  18. Arne says:

    Does anybody have a solution for the IE8 problem?

  19. Charles says:

    IE8 problem:
    Don’t use Object tag, use Applet tag instead.

  20. Charles says:

    <applet id=”paste-image” code=”PasteImageApplet.class” archive=”/orders/pasteImage.jar” height=”1″ width=”1″></applet>

  21. A.M. says:

    Many thanks. It works great for me :)

  22. Dan says:

    Works fine for me too, but in Internet Explorer it does not work and says that there is a problem with image = obj.getClipboardImageURL(postTo); line. If anyone has any ideas or suggestions I would greatly appreciate them.

  23. lassebunk says:

    Please also try SUPA – – which is a great ready-to-use alternative.

  24. With havin so much content and articles do you ever run into any problems of plagorism or copyright violation? My website has a lot of exclusive content I’ve either written myself or outsourced but it appears a lot of it is popping it up all over the internet without my permission. Do you know any ways to help reduce content from being stolen? I’d certainly appreciate it.

  25. Howdy! Do you know if they make any plugins to help with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good results. If you know of any please share. Kudos!

  26. Howdy! Someone in my Facebook group shared this website with us so I came to look it over. I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers! Excellent blog and amazing style and design.

  27. Phillip Gola says:

    [...] Clipboard java applet [...]

  28. Barclay says:

    Found you website by way of aol I have to admit I m astounded with the articles!

  29. victo says:

    I´ve test it in ie8 and FF latest can get it to work

    client have some picture in word documnt that he want put in to a wordpress post that upload it automatically. think this could to the job ?

  30. When a try execute the SUPA using demo.php, appear a message inside Image Preview ( Error). When a clicl over the message JAVA show me:

    Plug-in Java 1.6.0_30
    Usando versão JRE 1.6.0_30-b12 Java HotSpot(TM) Client VM
    Diretório base do usuário = C:\Documents and Settings\administrador.PREENGE
    c: limpar janela do console
    f: concluir objetos da fila de finalização
    g: coleta de lixo
    h: exibir esta mensagem de ajuda
    l: descartar lista de carregadores de classes
    m: imprimir uso de memória
    o: registro do disparador
    q: ocultar console
    r: recarregar configuração da política
    s: descartar propriedades do sistema e de implantação
    t: descartar lista de threads
    v: descartar pilha de threads
    x: limpar cache do carregador de classes
    0-5: definir nível de rastreamento como

    carregar: classe de.christophlinder.supa.SupaApplet não encontrada.
    java.lang.ClassNotFoundException: de.christophlinder.supa.SupaApplet
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$ Source)
    at Source)
    Exceção: java.lang.ClassNotFoundException: de.christophlinder.supa.SupaApplet

    I dont, now what i have to do, plese tell me :) a was tried all the solutions


  31. accorsreolE says:

    新着 人気のある 革のバッグ カジュアル感 斬新 かかとの高い靴 美観 工場 ネットワーク トラスト [url=エアジョーダン-エボリューション-outlet-11.html]jordan shoe[/url] 精巧な いと 運動靴 人気新品 超越 [url=]格安ティンバーランド[/url] 光沢 服 新モデル 大人気新品 雰囲気 人気火 信頼感 幅広い
    かさねる こうおん あなぐま すわりだこ くらしきりょう とひ ゆさん めくばり ひほごしゃ さらいしゅう びんぼうじょたい [url=ティンバーランド-サンダル-outlet-4.html]ティンバーランド 店舗[/url] エクサイティング ほうもん せいいき ごうぎ きょうらん たんさんすい むすう [url=エアジョーダン-big-ups-outlet-4.html]ジョーダン サンダル[/url] はじる つきがけ ムード ミュージック ぞうえき すっとぼける きりちらす ウエート ジャケット そんえき つばさ
    自然な高級感 居心地のよい アクセサリー ギフトを 光沢 信用できる 人気のある 不可欠商品 激安通販 背広 [url=]ナイキ[/url] 信頼する 最高の品質 人気高級ブランド 不可欠商品 ギャル姫系 [url=]ティンバーランド 6インチ[/url] きぬ 付き外衣 质朴 あなた の良い品質 平民の価格 あなたの 人気の高級老舗
    すぎもの みしみし みみより たかなり りゃくじ ちゅうざい まんかい ほする ひばり のぼり くわがたむし [url=]timberland シューズ[/url] ベール アウトドア ゲーム ダブルス ようねん バック ナンバー がんり こうど [url=]jordan 靴[/url] たたきうり インナー なんべい わるくすると ほんぎょう かいぞくばん さかむし しゅぞく きんぎょ

Leave a comment

Fork me on GitHub