Friday, May 4, 2012

USMLEworld Client on Ubuntu 12.04

[UPDATE 14 Sep 2013:  In order to use this method, you must download the version of USMLEworld for OS X 10.6 or earlier, which is still a .jnlp file.]  

I was setting up a laptop for a friend to use while she visits me and studies for her Step 2 exams, and decided to set her up with Ubuntu 12.04 and KDE Plasma, which are both excellent, free and open source products.  Though I still don't like Unity and prefer Gnome or KDE, I was so impressed with Ubuntu 12.04 overall that I converted over all of my systems without incident.

Other than a word processor and web browser, the only thing she needed was to run the USMLEworld software.  While the USMLEworld website proclaims that it is Windows, Mac, iPhone/iPad and Android only, I assured her that it would work.  It's a Java app, and perhaps the biggest selling point of Java is that it runs basically anywhere.  I downloaded the app using the instructions for Macintosh, and ran the command

javaws qbankclient.jnlp

It happily loaded up a number of files, then popped up a window that said, "Windows and Mac Only" and quit.  Really?  A simple multiple choice question program won't run under Linux?  I found that hard to believe. I wondered what would happen if I spoofed the operating system.

javaws -property os.name=Mac qbankclient.jnlp

Note that if you're using Ubuntu with Gnome instead of KDE, you may also have to remove gnome-screensaver as apparently they are able to detect it and disallow you from taking any tests.

sudo apt-get remove gnome-screensaver

At any rate, it works just fine!  USMLEworld, shame on you for crippling your software just to exclude open operating systems, and double shame for being so bad at it.  By the way, should you require the services of an internationally recognized programmer with three bachelor's degrees and a PhD in Physics, as well as over 10 years of industry experience, a link to my CV is to the right, and I am available for contract work!

Technical details:  I am using openjdk-6-jre and icedtea-plugin.

27 comments:

  1. Dear Sir,

    You are amazing!! I have been looking for a solution to this forever, I love ubuntu, but having a hard time getting uworld to work... I followed what you did but couldn't get it work... Would it be possible to help a newbie with detailed instructions? Thank you so much!

    ReplyDelete
    Replies
    1. Hi Shawn--

      Can you tell me what error you're getting when you do this? Literally all I had to do under KDE was run the first green line in a terminal. To make it work under Gnome, I had to run the second green line first to remove the screensaver.

      Delete
    2. Hi Ben,

      After inputting your first green line this is the error I get in terminal:

      netx: Invalid jnlp file qbankclient.jnlp

      I have saved the qbankclient.jnlp in my downloads folder in home and also I am running the default settings in Ubuntu (unity) Haven't switched to Gnome.

      Delete
    3. Oh! That's simple enough to fix. You need to make sure that you include the proper path to your .jnlp file. For example, if your .jnlp file is in downloads and you run that command in your home directory, javaws will not find the file and give that exact error. I don't know where your downloads directory is (I don't seem to have one), but you can find the path to it with this command:

      find -name "qbankclient.jnlp"

      Now you need to either navigate to that directory and run it, or just tell javaws what that directory is:

      cd /whatever/the/path/was/
      javaws -property os.name=Mac qbankclient.jnlp

      or:

      javaws -property os.name=Mac /whatever/the/path/was/qbankclient.jnlp

      I'm not sure if you'll encounter further problems in Unity like I did in Gnome, but at any rate that should fix the invalid jnlp file problem. Good luck on your Step 2 exams!

      Delete
    4. Hey Ben,

      Thanks a lot.

      Shawn, I was running in the same issue. All I did was removed the "/" after Mac in "javaws -property os.name=Mac /whatever/the/path/was/qbankclient.jnlp" and it started working.

      I am using Ubuntu 12.04 and a noob when it comes to using linux.

      Hope this helps.

      Delete
  2. Hi,
    this worked great for me. Thank You. Is there anyway to create a desktop shortcut (so I don't have to open up Terminal every time)?

    ReplyDelete
    Replies
    1. They made this so hard to do in Ubuntu 12.04 (across Gnome and KDE, at least) and I'm not sure why. I don't know what version of Linux you're using or what desktop, so you'll have to Google for the means to do it for your particular environment. Here's an example for KDE and Gnome circa 2008:

      http://www.techrepublic.com/blog/howdoi/how-do-i-create-desktop-icons-in-kde-and-gnome/193

      Now, if find a web page with the procedure for your environment, you will ultimately end up in a window that looks like their figure F or figure J. In the "command" textbox, you're just going to put in:

      javaws -property os.name=Mac /your/path/to/qbankclient.jnlp

      and then you should be good to go!

      Delete
  3. I tried to do this but it was giving me trouble and I was feeling impatient haha.

    I already had Wine installed anyway for other programs so I installed the Windows version of Java7 through Wine. Then just set the default application to open qbankclient.jnlp to Wine. Anyway, just wanted to share in case you're interested or for anyone else who still has trouble!

    ReplyDelete
  4. Hey Ben,
    Thanks for the quick fix, it works great so far even for step 3 and the sim exam (which doesnt have a web based thing) :)

    ReplyDelete
  5. Ben,
    which javaws are you running? I'm running Linux Mint and there isn't -property option that goes with it. Thanks.

    ReplyDelete
    Replies
    1. I'm using openjdk-6-jre and icedtea-plugin. You should be able to install these through Synaptic. You can check which java client you're using with "javaws -about" and "java -version".

      Delete
    2. Thank Ben for getting back to me so fast. I already spent two precious studying days to figure this out but couldn't. Do you mind if you can download the jnlp and run it again with the configuration, to see if they have patched it against your method? I tried the Wine method of Venessa, but although it passes the OS test it fails the login to the actual QBank. I'm a bit at the wits end now haha.

      Delete
    3. Unfortunately I no longer have the machine that I used this method on. Can you tell me what error you get when you use my method, or can you confirm that you're actually using the same version of java and javaws? If you don't have -property on javaws, I would guess that you need to use Synaptic or apt-get to install the same version of java and icedtea as me.

      Delete
    4. Ben, I used a Ubuntu 12.04 livecd, installed the exact java/icedtea, and voila, it worked!!!! I can't thank you enough. I was working on it with Linux Mint, and maybe it was because of the repository (Mint 11) or something, but it kept giving a unsigned error. But it works!!! It works!!

      Thank you sooo much man. This is enough to give Ubuntu a new home in my sandbox partition.

      Delete
  6. Hi everyone, I have some issues trying to run the usmleworld qbank, I'm using ubuntu the latest version and after following in details the instructions, I got this:

    vladimir@vladimir-Inspiron-1420:~$ javaws -property os.name=Mac qbankclient.jnlpnetx: Invalid jnlp file qbankclient.jnlp
    vladimir@vladimir-Inspiron-1420:~$ ^C
    vladimir@vladimir-Inspiron-1420:~$ javaws -about
    icedtea-web 1.2 (1.2-2ubuntu1.2)
    Launching about window...
    vladimir@vladimir-Inspiron-1420:~$ javaws -property os.name=Mac /home/vladimir/downloads/qbankclient.jnlp
    netx: Invalid jnlp file /home/vladimir/downloads/qbankclient.jnlp
    vladimir@vladimir-Inspiron-1420:~$ javaws qbankclient.jnlp
    netx: Invalid jnlp file qbankclient.jnlp

    w

    ReplyDelete
    Replies
    1. It seems like your qbankclient file is either corrupt or not where you think it is.

      Try this command: ls /home/vladimir/downloads/qbankclient.jnlp

      If you get an error "cannot access qbankclient.jnlp", then it's not where you think it is. You can find it with the command "find -name "qbankclient.jnlp". Otherwise, you should try re-downloading it.

      Delete
  7. They have since patched your workaround. The file is now called qbankappinstaller.dmg which is no longer a .jnlp

    Any ideas?

    ReplyDelete
    Replies
    1. I was wondering how long it would take them to do that!

      Unfortunately, I don't have an account to test with but I will take a look and see if I can find a workaround. The fact is that if they're still using Java then it is possible to spoof the OS--but there's no telling what irritating mechanisms they may have inserted!

      Delete
    2. This actually still works if you download the version for OS X 10.6 or earlier...that file is still a jnlp. You can run it using Ben's technique and it will create a desktop icon/shortcut. You can then edit the shortcut's property to add in the -property os.name=Mac part right after the javaws and you'll be able to run it just by clicking on the desktop icon.

      Delete
    3. Thanks for letting me know! I have updated the post for the benefit of future readers.

      Delete
  8. If anyone is searching for alternatives, you can still open the windows version with WINE + Java plugin (plenty of bugs), or by installing it on a windows virtual machine. Neither are as easy as Ben's former solution.

    Thanks for your help, Ben. It was great while it lasted.

    ReplyDelete
  9. So I've tried this trick on ubuntu, and it lets me open up UWorld and take quizzes. However, whenever I am actively on a quiz, I can't use any other application - not just the dreaded can't-copy-paste, but I can't type or do anything else at all (for example, a google search or typing in a word document). The only way to do this is to suspend the quiz, which is rather time consuming. Any thoughts?

    ReplyDelete
  10. So I've tried this trick on ubuntu, and it lets me open up UWorld and take quizzes. However, whenever I am actively on a quiz, I can't use any other application - not just the dreaded can't-copy-paste, but I can't type or do anything else at all (for example, a google search or typing in a word document). The only way to do this is to suspend the quiz, which is rather time consuming. Any thoughts?

    ReplyDelete
  11. Hi I am trying to use this workaround but I am not able to make it work. Does anyone have any idea? this is the error I am getting when I run it form the terminal. I can run it directly form the file and it asks me the permission to create a link on desktop and it shows a bar where it downloads all the files but nothing happens after it.
    javaws -property os.name=Mac UWorldClient.jnlp
    java.security.AccessControlException: access denied ("java.io.FilePermission" "/usr/bin/xprop" "execute")
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
    at java.security.AccessController.checkPermission(AccessController.java:884)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
    at java.lang.SecurityManager.checkExec(SecurityManager.java:796)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1018)
    at java.lang.Runtime.exec(Runtime.java:620)
    at java.lang.Runtime.exec(Runtime.java:450)
    at java.lang.Runtime.exec(Runtime.java:347)
    at org.GNOME.Accessibility.AtkWrapper.(AtkWrapper.java:34)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:805)
    at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:886)
    at javax.swing.UIManager.getSystemLookAndFeelClassName(UIManager.java:611)
    at net.sourceforge.jnlp.runtime.JNLPRuntime.initialize(JNLPRuntime.java:218)
    at net.sourceforge.jnlp.runtime.Boot.init(Boot.java:326)
    at net.sourceforge.jnlp.runtime.JnlpBoot.run(JnlpBoot.java:58)
    at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:245)
    at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:63)
    at java.security.AccessController.doPrivileged(Native Method)
    at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:195)

    SYNOPSIS
    javaws [-run-options] jnlp file
    javaws [-control-options]

    OPTIONS
    .......it goes with option of javaw


    thank you very much

    ReplyDelete
  12. I can send the file if someone wants to try it

    ReplyDelete