I wanted to use Haploview to visualize the haplotype structure around a genomic area of interest. Thinking it would be a quick, simple task I downloaded the Windows installer and installed it on my computer. When I tried to open the program, I kept getting the error: Cannot run program "c:\program": CreateProcess error=2, The system cannot find the file specified. After tinkering with things myself and getting some assistance from the IT staff, here is the workaround we developed to install Haploview on newer Windows operating systems.
1) Download the newest Haploview.jar file and save it to a location where you want to permanently keep it, for example: "C:\Haploview\". This .jar file contains all the Java code needed to run Haploview.
2) For most 64-bit Windows operating systems, the newest version of Java will usually run Haploview. The most current version is available for download here. For 32-bit versions of Windows operating systems, Haploview seems to be a bit pickier about what version of Java will run Haploview. I have had the best luck with Java version 6 update 43 and earlier. They can be downloaded from the Oracle Java archive. Click the radio button to accept the license agreement and select the Windows x86 Offline version for download. The next page will ask you to sign in or sign up for a free account. Just complete the form and the download will begin after you log in.
3) Use Notepad (or Notepad++) to create a Haploview.bat file in the same directory you placed the Haploview.jar file with the following code in it. The Haploview.bat file is simply created by pasting the below code into Notepad and then saving it as Haploview.bat. This is just a quick and easy way to open a command prompt in the background and run the Haploview.jar file in Java.
For 64-bit Windows operating systems use the code:
For 32-bit Windows operating systems use the code:
(Note: The code for the 32-bit Windows operating system explicitly states the version of java to run, i.e. "C:\Program Files\Java\jre1.6.0_43\bin\java.exe". This allows us to avoid having to set up a path variable in Windows (which I have found buggy and difficult to set up). The "jre1.6.0_43" portion in the path is an example of where your version 6 Java is located. Lower versions of Java 6 will be "jre1.6.0_##", where ## is the version number. If you only have one version 6 of Java on your computer, the folder will named "jre6".)
4) Right click on the Haploview.bat file you just created and choose create a shortcut. This shortcut is now what you can use to open Haploview. Cut and paste this shortcut into a location that is easy to access. I put it in my Start Menu under All Programs, but pasting it on the Desktop works well too.
Hope this was helpful and saves those interested in using Haploview on newer 32- and 64-bit Windows operating systems a lot of time. While these tips should be useful for getting Haploview to run on a majority of newer Windows operating systems, it may still take a bit of trial and error to get Haploview up and running. If you are still having difficulty getting Haploview to work with newer versions of Java, try older versions from the Oracle Java archive and follow the above instructions for 32-bit Windows operating systems. Also, check out the comments section below to see what has worked for others. If something has worked for you and its not posted below, please share!
A repository of programs, scripts, and tips essential to
genetic epidemiology, statistical genetics, and bioinformatics
Welcome to the Genome Toolbox! I am glad you navigated to the blog and hope you find the contents useful and insightful for your genomic needs. If you find any of the entries particularly helpful, be sure to click the +1 button on the bottom of the post and share with your colleagues. Your input is encouraged, so if you have comments or are aware of more efficient tools not included in a post, I would love to hear from you. Enjoy your time browsing through the Toolbox.
Subscribe to:
Post Comments (Atom)
May I know what Java version you are currently using? I tried the method mentioned but I still get the same error prompt.
ReplyDeleteThanks!
Hi Ben! I have Java version 1.6.0_37 (64 bit) on my laptop and the most current release (as of May 15) on my desktop. Both work using this method. I am less than an expert with Java, but a few things that may be useful to check is to ensure you have the correct path specified to the downloaded Haploview.jar file in your command and that you have the latest release of Java installed on your machine. You can also drop the -d64 option, but that really shouldn't make a difference. Hope you figure things out and let me know what the fix is so I can post it for others!
DeleteI am using 32bit window 7 and recent JRE(v7.25). I followed yor recommendation except '-d64'. However, it still doesn't work. Do you have any other comments for me?
ReplyDeleteThanks.
Do you get a specific error message or will nothing happen? If nothing is happening it may be an issue with the Haploview directory in the .bat file not being recognized appropriately by Windows (spaces in file directory names tend to cause issues). Will it work if from the Windows command prompt you go (cd) to the directory that you downloaded the Haploview.jar file and type "java -jar Haploview.jar" at the prompt?
DeleteI was bashing my head against a brick wall for 4 hours or so to try to figure out how to get around this issue... I will try to post this in a couple of comments as I was having issues to post.
ReplyDeleteI too tried to download the Windows Haploview installer from the Haploview website (I am using 32bit Windows Vista) and I could install it no problems, but when I clicked on the icon to open Haploview, I got the same error message "Error: Unable to launch Haploview. Cannot run program: CreateProcess error=2, The system cannot find the file specified". I then downloaded the Haploview.jar file from the Haploview website and tried launching Haploview by double-clicking it (same error), by opening command prompt window and typing: java -jar Haploview.jar (same error), and by creating a bat file as outlined by the original poster (same error).
Unfortunately none of these methods, even trying various modifications to the bat file, worked for me.. I still kept getting the error. I am not that good at programming but eventually after reading forums on general Java issues I found a combination of stuff that worked for me. I won't go through all the stuff I tried but just list the steps that worked:
ReplyDelete1) Find an older version of Java (around 2009 is good) which would have been the version when Haploview was first made/used. The current version of Java is JRE(v7.25), but I also had JRE(v6), JRE(v1.6.0_24) and JRE(v1.6.0_07). I could see a folder for each version when I went to C:\Program Files\Java. I am not sure if the older versions are still available online for download, but I can try to upload the files here or people can email me for an older version if I am not able to upload files.
2) You have to make a PATH in the environmental variables that points to the right folder. To do that:
- a) Right Click My Computer. Go To Properties.
- b) Click Advanced System Settings.
- c) Click Environment Variable
- d) In the Environment Variable window, I had two boxes, one on top that says "user variables" and one on bottom that says "system variables". Just under the lower "system variables" box, click "NEW"
- e) Type "JAVA_HOME" (the underscore is important) in the Variable Name box, type "C:\Program Files\Java\jre1.6.0_24\bin" in the Variable Value box. Then click Ok, and it should appear in the system variables box. Then just click ok to get out of that dialog.
As far as I understand it, this makes a path that the operating system uses to locate where the executable file java.exe is and will let the computer open the older version of Java when you run a .jar file.
ReplyDelete3) You have to open command prompt in Windows. I went to the start menu, and in the search bar I typed "cmd", what came up was "cmd.exe" which I clicked on to open the black command prompt window. By default it said C:\Users\Bec. To change the directory so it reads C:\, I typed: cd.. then enter. Then did it again.
4) I had tried typing "java -jar Haploview.jar" (without quotes) into command prompt before but I had still got the error. But what worked was changing the directory to specify where the java.exe file was (this should be the same as the JAVA_HOME path just created), and then specifying the file path of where my Haploview.jar was, all in one line.
To change the directory, I typed "cd Program Files" then enter, then "cd Java" then enter, then "jre1.6.0_24" (the name of the old version of java) then enter, then "bin" then enter (all without the quotation marks). It should then say C:\Program Files\Java\jre1.6.0_24\bin> . Then type the following:
java -jar "C:\Program Files\Java\Haploview.jar"
with the quotation marks around the filepath of the Haploview.jar file... this bit in quotes is the folder where I originally had saved the Haploview.jar file. I think it will probably work in another folder as long as you put the exact filepath in quotes when you do the command.
Then hit enter... the command prompt blinked for about 20 seconds (which is good as I had been getting error messages instantly before that) and then Haploview opened!
I hope this helps anyone else trying to make Haploview work and I hope it works for you too. My flatmate tried this exact same method on his Windows 7 (32bit) computer and it worked for him as well, even though I had tried it on Windows Vista. He and I think the problem was that Haploview was created on a specific version of Java Runtime Environment --- given the fact that Haploview seems to have not been changed for a while, while Java has continually updated, maybe it is a combination of the fact that an older version of Java is needed, as well as being very specific in specifying where your java.exe is and where the Haploview.jar file is when you want to run it.
Anyone with programming background... can you explain further maybe? But as long as it works, I don't really care why :)
Bec
Thanks, Bec. I have been meaning to update this post for a while, especially with the bit about the changing the PATH variable. Getting Haploview to work on newer 32-bit Windows OSs is never easy, but hopefully the above comments will be useful to those trying to do so in the future. Thanks again.
DeleteThe post has just undergone a major revision that has incorporated feedback from commenters. It is much more comprehensive and applies to both 32- and 64-bit Windows operating systems. Hope this solves a lot of problems previous commenters were having.
ReplyDeleteAfter over 6 hours of trying to get haploview to run, Bec, you finally got it up and functioning for me. Thank you! Do I have to go through this entire process every single time I want to open haploview?
ReplyDeleteNo problem :)
DeleteAs for opening haploview in the future... when you go to "Environmental Variables" to create the PATH file, that just stays there unless someone changes it. So you don't need to do that again. But you do need to open command prompt and type in the bit about
C:\Program Files\Java\jre1.6.0_24\bin (to change the directory)
and then the bit about
java -jar "C:\Program Files\Java\Haploview.jar" (to launch Haploview.jar)
I followed the Admin's suggestion to make a .bat file to do these steps for me. I would just add a bit of extra detail to the Admin's notes, because I am not a programmer/computer guru and there are little things that might be obvious to others but not to someone like me... for instance, how to make a .bat file!
I opened a Notepad document, and typed the following into the blank doc:
cd C:\Program files\Java\jre1.6.0_24\bin
java -jar "C:\Program Files\Java\Haploview.jar"
pause
Then I saved it as "Launch Haploview.txt" i.e. saved as a plain old text file.
It is important that the second part (the java -jar bit) is on a separate line to the cd change directory part. I had them on the same line originally and it wasn't working for me! So frustrating! I also added the line with "pause" because otherwise the command prompt window opens and closes instantly, and if there are any errors or problems with running the file, you don't have time to see the error message. That "pause" will make the command prompt window stay open and you can see your command running properly or any errors that come up. But first you need to change the txt file into a bat file.
My flatmate told me that to turn a txt file into a bat file you have to change it in command prompt window, but I found a simpler way on yahoo answers (of all places):
This is from http://answers.yahoo.com/question/index?qid=20080427142551AA8Cl7C
>Open up the text file in Notepad, and from the "File" menu choose "Save As...". When the prompt comes up, save it as the name of your batch file ENCLOSED IN QUOTES. If the file name isn't enclosed in quotes, it will not save it as a .bat. For example save as:
"batchfilename.bat" (quotes included!)
You will be prompted that the file extension is changing, but that's okay, just acknowledge and approve the change. Then, you're done.<
That worked for me... the file changed to "Launch Haploview.bat" and then I had a new .bat file. I just created that bat file on my desktop so I didn't even need to create a shortcut, I just double-click the .bat file and it opens command prompt, runs the command, and opens Haploview. You can close the command prompt window after Haploview is open.
Kaileigh, if you create a windows .bat file specifying the path to the java.exe version that worked in quotes and the location of the .jar file in quotes all you will need to do in the future is double click on the .bat file and Haploview will automatically start up. See #3 in main post for more details and #4 for creating a shortcut to the .bat file.
ReplyDeleteHi,
ReplyDeleteAfter fighting this problem for a goodly time, helped by your suggestions and uncle Google, I just solved this problem for a coworker in the following way:
System: 32bit Win7, danish locale.
Java: JRE7
Without making changes to path or environment variables, I instead downloaded the Haploview Installer and ran it. This gave a shortcut and associated .exe-file, which I right-clicked and chose properties...Compatibility.... Run this program as... "Windows 98/Me". And It worked - both on her laptop and desktop pc.
Simple and easy, many thanks mate;
DeleteWorking like a boss :D
it works! and the method with .bat file did not work.
DeleteThank you.
Yay!!
DeleteThank you :)
This worked for me. Thank you!
DeleteUnder- Run this program as... "windows 7" and it worked. Thanks
DeleteGreat, this simple fix seems to be working for a lot of people.
DeleteYet another person who had trouble with this; figured it out:
ReplyDeleteI have 64-bit Windows 8. I did everything from the original blogspot and noticed the command window would pop up when I double-clicked the .bat file with an error: "Unrecognized option: -d64"
So I removed -d64 from the .bat and everything worked.
So if you put Haploview.jar into C:\Haploview, Haploview.bat should include: java -jar "C:\Haploview\Haploview.jar" (with quotes included)
Hope this helps!