Thursday, June 3, 2010

Seamless Java RDP client

(I had done this two years ago and posted on my personal website. I never thought someone still sent email to me for this, even ask for source code. I think maybe more people want to know it. Posting on blogger is absolutely much popular than on my personal website).

It is built base on properJavaRDP, which is an open source Java RDP client for Windows Terminal Services. The idea of "seamless" is come from rdesktop, which is a open source RDP client on unix platform. "seamless" can make remote running application looks like running locally. I upgrad properJavaRDP code from AWT to Swing, and add the functionality to handle "seamless" message in a special rdp vchannel.

 new update(2010.06): support window 2008 now (solve problem of “wrong modulus size! expected64+8got:264”)

new update(2010.06.17): support seamless mode applet

Seamless Java RDP client

It is a general Java RDP client for Windows Terminal Services with "seamless" feature. It is built base on properJavaRDP.

Product details


To use seamless feature, you need seamlessRDP server extension. A SeamlessRDP server extension is available to support integration of individual applications with the client desktop. Precompiled binaries are available from Cendio (If you want Connetion sharing feature, you have to get patch from http://www.fontis.com.au/rdesktop). My contribution is updated properJavaRDP code from AWT to Swing, and add the functionality to handle "seamless" message in a special rdp vchannel. jdk1.6.0-10 is needed, since shaping jframe is a new feature of jdk1.6.0-10.

To download the client jar file: javaRDP16-1.1.jar. A usage document is here:HowTo.

I also write a Adito extension: adito-application-seamlessjavardp.zip. Just for you convenience, i upload service side exe package here:seamlessrdp_server.zip.

(05/12/2009) Recently, i got chance to take a look at "rdesktop session connection-sharing" from http://www.fontis.com.au/rdesktop. It is a very interesting feature which can save TS session. I think it is good to port this feature to my seamless JavaRDPClient. It took me one day to do this. I have updated all above link with the new update. Welcome you to try this cool feature.

"Connection sharing - allows a single rdesktop connection to launch multiple applications. When run in seamless mode, rdesktop creates and listens on a control socket. A new option allows rdesktop to be run in slave mode, which notifies the master rdesktop instance of a new command to be run and then exits. The master instance sends a client-to-server message to the SeamlessRDP server component, which runs the new command".

see the difference of "seamless rdp" from normal rdp client with following screenshot:

1. nornal properJavaRdp client: ie and notepad is running on a remote server. you can see there is always a "frame" around the remote application.(My OS is english version XP, remote server is a chinese version windows 2003)

2. Seamless rdp client: ie and notepad is running on a remote server. you can are running like "local" application. (My OS is english version XP, remote server is a chinese version windows 2003)

The usage:

First, On windows as server

download seamlessrdp_server.zip and upzip it to C:\seamlessrdp

Then, on client side (windows or unix support jdk1.6u10),

Run the pure seamless client:

c:\>java -jar JavaRDP16-1.1.jar -u administrator -p 111111 -fs -s "C:\seamlessrdp\seamlessrdpshell.exe C:\Program Files\Internet Explorer\iexplore.exe" 192.168.1.135:3389

Run as seamless client with Connection-sharing feature:

1. start the firt client :

c:\>java -jar JavaRDP16-1.1.jar -u administrator -p 111111 -fm -s "C:\seamlessrdp\seamlessrdpshell.exe C:\Program Files\Internet Explorer\iexplore.exe" 192.168.1.135:3389

2. start more client but share the same connection with above one:

c:\>java -jar JavaRDP16-1.1.jar -fc -s "C:\Program Files\Internet Explorer\iexplore.exe"

------------------------------------------------------------------------------------------------------------------------

How to run as applet:  

(take a look at exampleHtml to be aware of how to fill the params.)

First, the JavaRDP16-1.1.jar should be signed, and make sure it is in the right directory. I wrote a html(javaRdpApplet.html) and “sign.bat” in case you do not know how to sign and run the RDP jar.

Step by step:

1. create self certification and sign the jar package. In “sign.bat”, there are four commands to be executed:

keytool -genkey -dname "cn=BeanSoft Studio, ou=Java Software, o=BeanSoft Studio, c=China" -alias beansoft -keypass beansoft -storepass beansoft -validity 365 -keystore .\beansoft

keytool -list -keystore .\beansoft -storepass beansoft

keytool -export -keystore .\beansoft -storepass beansoft -file beansoft.cer -alias beansoft

jarsigner -verbose -keystore .\beansoft javaRDP16-1.1.jar beansoft

If you already have your certification file, you may just need to run the command in last line.

Before running sign.bat, the file list is as below:

clip_image002

2. run the sign.bat, you will get a window as below, input your password, in my case, it is “beansoft”.

clip_image004

3. Now, you got file list should like:

clip_image006

Notice that the size of javaRDP16-1.1.jar is bigger than original one. (in my testing, it is from 352KB to 374KB). It is becase it is signed. “jarsigner” add some file to META-INF.

4. Now you can try javaRdpApplet.html with IE explorer. I got message like below and it work well if you input correct IP address.

clip_image008

47 comments:

  1. Is it possible to download the source to the Java RDP client?

    ReplyDelete
  2. Do you have the source code for the Java client?

    Thanks.

    ReplyDelete
  3. I'm also interested in the source - which you should be providing under the GPL! :-)

    ReplyDelete
  4. Hi, do you know how to run this as an applet?

    ReplyDelete
  5. I mean, what params the applet needs? could you post the javaRdpApplet.html? I don't find it. Thanks

    ReplyDelete
  6. Hi, it's a great tool.
    Adito package tool adito-application-seamlessjavardp.zip not is compiled with the new version for solve problem of “wrong modulus size! expected64+8got:264”?
    Thanks for all

    ReplyDelete
  7. applet work well now. the example html file attached.

    ReplyDelete
  8. adito-application-seamlessjavardp.zip has been updated.

    ReplyDelete
  9. Thanks for the article and applet! I got here in search of a Java RDP client that did not have the wrong modulus size error connecting to Windows 2008/Vista/7.

    I'm running an Adito box so I installed the Adito extension. There's just one problem remaining and that is the screen does not line up correctly. I've uploaded a screenshot to show what I mean here: http://yfrog.com/j7screenshot20100621at245p

    ReplyDelete
  10. To RogierG: I took a look at your scrrenshot. I would suggest you do not use -fm option if you want full screen.

    ReplyDelete
  11. @yellowstonemay: thanks for your reply. I would like to use the application in a window if possible. I don't need to use seamless apps but your version of the Java RDP Extension is the only one that works.

    The one from Elusiva gave a correct window but the wrong modulus size error, I fixed this by copying the secure.class from your version to Elusiva's.

    The only remaining issue is that your client is able to reconnect disconnected sessions, and Elusiva's is not. So either I would like to fix the window problem on your version or I would like to fix the reconnect issue in Elusiva's version :-).

    Do you have any idea why your version is able to reconnect and Elusiva's is not? Any classes I could try to copy from your version?

    ReplyDelete
  12. Please, could you release the code? If I am not wrong, your version is based on elusiva's, and so on properJavaRDP's. The license is GPL, and how it says:

    "...For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights..."

    I really apreciate your contribution and your great job, but if your effort started from a project with GPL license, you should do it right.

    If I am wrong or if the code is released in other place, please accept my apologies and give us some information.

    Thanks.

    ReplyDelete
  13. I would also like to have a copy of your GPL code. I would like to add some custom applet parms, and would appreciate being able to start with your version instead of the properRDP version. Please let me know how to get a copy of your source. Thanks

    ReplyDelete
  14. I would also like the source code for your GPL derived program. I'm trying to bring a GPLed RPD client to the android platform.

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. source code will be available on google code

    ReplyDelete
  17. Upload the source code ......

    ReplyDelete
  18. Since you have not posted a link to your code, could you at least explain what changes you made to get 64-bit support? I tried building properRDP based on most current sources (which are pretty old), and it just disconnects when trying to connect to Server 2008R2. But your javaRDP16.jar works! Please help!

    ReplyDelete
  19. Correction on my question about 64-bit support, apparently the issue is with rdp5. When I use the --use_rdp4 switch, I can connect to a 2008R2 server (with rdp4 limitations). I would like to get rdp5 working, though! Again, please post, email, or describe fixes. Your help here would be greatly appreciated, as I have been stalled on this for a few weeks.

    ReplyDelete
  20. code is available at http://code.google.com/p/lixia-javardp/, welcome your comments and support.

    ReplyDelete
  21. Thanks for the code posting. After downloading it, I could see that I was 99% there on my own, except for:

    RDP_DATA_PDU_DISCONNECT
    if(RdesktopSwing.loggedon || ext_disc_reason[0]>0){
    return true;
    }

    This solved my server2008 problem.

    Thanks again.

    ReplyDelete
  22. Will this work through a gateway or proxy?

    ReplyDelete
  23. I get your source code and re-build it using apache-ant..

    When I tried to use seamless feature, I got this message:

    D:\JavaRDP\lixia-javardp\dist>java -jar JavaRDP2.0-20101027.jar -u ami -p ami -f
    s -s "c:\seamlessrdp_server\seamlessrdpshell.exe notepad" 10.10.10.2:3389
    0 [main] INFO com.lixia.rdp.RDPClientChooser - RDPClientChooser
    2 [main] INFO com.lixia.rdp.RDPClientChooser - RDPClientChooser.RunNativeRDPCli
    ent
    java.lang.ClassNotFoundException: com.lixia.rdp.seamless.SeamlessChannel
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.lixia.rdp.RdesktopSwing.main(Unknown Source)
    153 [main] INFO com.lixia.rdp - Elusiva Everywhere version 2.0

    ReplyDelete
  24. Anyone know how to share printers ?


    Best Regards

    ReplyDelete
  25. Have been working with the following, but am unable to get the wanted results (applet now starts with 640x480):


    Trying values as "yes" and "1" give the same result.

    I can see that the parameter can be set, but the either my value is wrong or the fullscreen parameter is actually not working.

    ReplyDelete
  26. Missed out on my previous post that I'm working with the parameter "fullscreen", using the values "true", "yes", "1" and "on".

    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. Is it possible to change the cursor colour? We have a black background so the cursor disappears in the RDP session

    ReplyDelete
  29. I'd just like to give a big thanks to the author... I have been trying to get rdp working through a browser off and on for about 6 months now. This post pushed me over the edge, in a good way! :)

    ReplyDelete
  30. This comment has been removed by the author.

    ReplyDelete
  31. Using the latest Client .jar file (JavaRDP2.0-20101111.jar) posted on:

    http://code.google.com/p/lixia-javardp/downloads/list

    it appears the "-fm" and "-fc" option switches have been removed or the -f option was changed somehow.

    Is connection-sharing still supported in the new version?

    ReplyDelete
  32. I just want to give tons of thanks to the author. It is really helpful! I used properJavaRDP before, but nobody to fix the bug of Windows 2008(wrong modulus size! expected64+8got:264). Now, i am concerning when to fix the bug of Windows 7. I did some debug, but it is really hard for me to fix it. Any help will be appreciated. Thanks.

    ReplyDelete
  33. Does anybody meet with the following error when connect to windows 7? Is there any solution to fix it?
    com.lixia.rdp.RdesktopException: Cursor not found
    at com.lixia.rdp.Cache.getCursor(Cache.java:178)
    2011-02-16 09:51:51 com.lixia.rdp.RdesktopException: Cursor not found
    at com.lixia.rdp.RdpJPanel.process_null_system_pointer_pdu(RdpJPanel.java:1512)
    3453 [main] FATAL com.lixia.rdp - com.lixia.rdp.RdesktopException: Cursor not found
    at com.lixia.rdp.rdp5.Rdp5JPanel.rdp5_process(Rdp5JPanel.java:108)
    at com.lixia.rdp.rdp5.Rdp5JPanel.rdp5_process(Rdp5JPanel.java:46)
    at com.lixia.rdp.ISO.receiveMessage(ISO.java:301)
    at com.lixia.rdp.ISO.receive(ISO.java:212)
    at com.lixia.rdp.MCS.receive(MCS.java:172)
    at com.lixia.rdp.Secure.receive(Secure.java:950)
    at com.lixia.rdp.RdpJPanel.receive(RdpJPanel.java:457)
    at com.lixia.rdp.RdpJPanel.mainLoop(RdpJPanel.java:571)
    at com.lixia.rdp.RdesktopSwing.main(RdesktopSwing.java:685)

    ReplyDelete
  34. First: Awesome what you've done so far.

    I've had this all working with the 1.6 version connecting to a XP desktop. The only problem I had back then was that the TAB key wasn't working and I need to upgrade my enviroment to Windows 7, so I moved on to the newer builds you posted on google code.

    Both the 2.0 versions here had the Cursor error connecting to Windows 7, so noticing that there were some changes after the last build I leeched the source, installed the JDE and compiled it.

    Now everything works again (including the TAB key) except that I can't get the remote desktop in a seamless window ...
    Everytime it runs windowed, so the bottom part of the remote session is outside my screen (because of te title bar of the window)

    Please help!

    I've been browsing the code for a day or 2 right now, but it seemes that the seemless part is handled within the seamlessrdp.jar and that part of the code isn't browsable/editable.

    ReplyDelete
  35. @Willott
    The black cursor thing has a simple solution: Give the mouse pointer on the destination session an other look. Eg. for example in Windows 7 assign the Aero themed pointers and the black pointer is gone.

    ReplyDelete
  36. @Fido
    Thanks for that, will give it a try

    ReplyDelete
  37. I build the latest code, but why it doesn't support -fm and -fc options as your example list above?

    ReplyDelete
  38. Hey buddy, how about some source code?

    ReplyDelete
  39. Very nice tool and easy to use!
    Is there any possibility to make this code runable as an Android app?

    ReplyDelete
  40. Thank for your tool.it running over iis6 and s k2003 ,run all application in seamless, but i try with iis7 and srv2008 i have only desktop and i can t run application.i dont known why.maybe try with apache server.

    Do you test to launch application with srv2008.

    Gréât job

    ReplyDelete
  41. Hey, I was just wondering whether any of these 2 features is supported in the latest version (javaRDP16-1.1 Lixia).

    1- Resizing screen support
    I found some of the code regarding full screen (with the -f option) in the code, however resizing does not work. The external canvas/frame is resized (grows or shrinks) but the content does not follow.
    I.e: if you start with full screen, and you resize the window, the RDP content does not shrink to fit into the newly sized canvas. Similarly, if you start off the applet with a given size, when increasing the window, the RDP content does not follow and you have basically empty(gray) borders on the sides.

    2- Reconnection
    When a disconnection (for some low bandwith or 'bad' internet users) occurs, an automatic attempt for reconnection is not possible. One has to re-launch the applet over again. Ideally an attempt for reconnection every t seconds would be great.

    Are these 2 features really missing in the code today or am I missing something/an option/etc...
    If they are missing, how easy, in your opinion would it be to add them? I thought I would check with you guys before diving into implementing them.

    Thanks and Great job on what is already a great RDP client,

    ReplyDelete
  42. Hey guys, can someone please help me, I'm using JavaRDP2.0-20101111.jar however, when I press need the question mark key, instead of the question mark appearing I receive the # sign. I enabled en-us within the parameters for the app, however this does not help. Can someone please help me fix this?

    ReplyDelete
  43. your link is not working for seemless download

    ReplyDelete
  44. hi, can u provide JavaRDP2.0-20101111.jar 's web java applet fullscreen seamless mode settings, i m facing problem with it. thanks in advanced.

    ReplyDelete
  45. Hi Zhou,

    I'm having a problem with adito-agent launcher. Since java jre 7.4+, users are not able to permanent accept the execution of unknown publisher's app, so they must agree and click execute each time the adito agent launcher starts.
    As i can see you now a lot about this so i encourage you to ask if there 's a way to sign the adito agent launcher.jar in order to avoid this security problem.
    If there is a way, could you please help me working around this?
    I've been reading about keytool and jarsigner tools but where? I must sign launcher.jar and then rezip the adito-agent extension??

    Regards Zhou.

    César from Argentina

    ReplyDelete