This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have been trying to create jar files that can operate by double clicking.I have succeeded in this before, and things were working quite well, until I installed and then uninstalled CodeWarrior 7. Now my jar files will not open on the double click. I did this before just by associating my executable jars with the javaw.exe in the jre, however now I get a error message saying that it is unable to locate the main class. I even went so far as to unistall and reinstall the sdk. Any suggestions?
Well, a couple of things to check: 1). Check your manifest file for you jars to make sure that you have a "Main-Class" attribute present. 2). run "jar -tf <youJarName.jar>" to make sure that your main class is present if the .jar file. If both of these check out fine, paste the exact error message you are getting and we'll see where else the problem might be.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Gerald B. Cormier
Joined: Oct 24, 2002
Both of these work out just fine. There is the Main Class attribute in the manifest file and I do get the contents of the jar file by running "jar -tf TestFile.jar". When I try to run the program I get the Java Virtual Machine Launcher trowing up a warning box just saying "Could not find main class. Program will exit!" How ever when I produced the ar file from the command prompt I gat the two lines saying "ignoring entry META-INF/ ignoring entry META-INF/MANIFEST.MF" Not sure if this is normal or not. Thanks in advane for any suggestions
I've never seen it say "Ignoring entry ...." 1). When you run "jar -tf TestFile.jar", are the META-INF/ and META-INF/MANIFEST.MF present in your jar file? 2). Does your manifest file have a newline after the Main-Class attribute? 3). What command are you using to produce your jar files?
Gerald B. Cormier
Joined: Oct 24, 2002
the MEAT-INF and MEATA-INF/MANIFEST.NMF are both present. There are no new lines after the Main-class: attribute. I really don;t think there is a problem with how I am creating the jar files. I tried to run the jedit installer jar file and the JVM Launcher still gives the same error. The installer works fine at the computer I use at work. As do all my jar files I created previous to this. The only difference between each machine is I have had CodeWarrior 7 wireless pro installed on the problem machine. This never happened untill that was installed. And unistalling it, even making sure ALL registry entries were deleted didn't help. Thanks for your help Joel. This is a real head scratcher.
Your Registry Entry has been corrupted or is missing. You need to check for an entry MyComputer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\javaw.exe\shell\open\command Make sure the value is something like C:\Program Files\JavaSoft\JRE\1.3.1_06\bin\javaw.exe -jar %1
IT WORKS!!! I looked in the registry and found lot's of references to codewarrior. As in the HKEY_CLASSES section. entries like .jar having a value of "CodeWarrior_JAR". So after alot of searching and deleting... then installing the jdk1.4.1_02 everything is back to normal. The next time I try out a new IDE I am making a backup of my registry just before I install it. I can' believe how much of a mess my regitry was in, even after uninstalling it. I guess I'm just silly in thinking that if you uninstall a program, ALL the data concernng it should be uninstalled, evn in the registry. lesson learned.
Thanks to you two for helping me, I was over a month pulling my hair out searching for a solution on net to try and solve this.
Originally posted by Gerald B. Cormier: IT WORKS!!! The next time I try out a new IDE I am making a backup of my registry just before I install it. I can' believe how much of a mess my regitry was in, even after uninstalling it. I guess I'm just silly in thinking that if you uninstall a program, ALL the data concernng it should be uninstalled, evn in the registry. lesson learned.
Couldn't agree more!!! That's why I hate these installers and love app like tomcat - you just unzip it in a folder and it starts working! - Manish