0

No matter what I do I cannot run an executable jar file of any applications I create lately. The jar files of applications that I have created weeks ago execute without a problem, but suddenly any applications I create now refuse to open. I have not made any changes to any of my Java file paths or files.

I have entered the correct javaw file path in my system registry, I have used the application Jarfix to try correct the problem, and I have tried setting the default program to run the file in the Control Panel. None of these work!

I tried running it from the command prompt and the file still will not execute and no errors come up. I checked the processes in the Task Manager and whenever I try to execute the file, the netbeans64 process appears and then immediately disappears.

What else can I do to try and fix this problem?

Osiris93
  • 296
  • 2
  • 18
  • 2
    when running the jar from command line, do you use `java -jar path/to/file.jar`? – Orin Jul 01 '16 at 17:44
  • Can you try `java -jar file.jar` – ryekayo Jul 01 '16 at 17:44
  • Possible duplicate of [Why is my Runnable Jar file not working](http://stackoverflow.com/a/16702670/113632) – dimo414 Jul 01 '16 at 17:47
  • @Orin2005 I just tried it like that and it says it's unable to access the jarfile – Osiris93 Jul 01 '16 at 17:58
  • @ryekayo I tried that and it didn't work – Osiris93 Jul 01 '16 at 17:59
  • 2
    @Osiris93, you need to add what the error message is. Simply saying that it didnt work is not enough info – ryekayo Jul 01 '16 at 18:09
  • @ryekayo Well when I tried it the way Orin2005 mentioned, the error message that came up was "Unable to access the jarfile" – Osiris93 Jul 01 '16 at 18:17
  • Why would netbeans appear when you launch your jars? – Shiro Jul 01 '16 at 18:18
  • @Osiris93 this usually happens when you are not pointing it correctly to the jar file. Lets say I have a jar file on my desktop. I would have to run the command `java -jar C:\Users\orin2005\Desktop\file.jar` Or I would have to use the command `cd` to change the directory to the Desktop – Orin Jul 01 '16 at 18:41
  • @Orin2005 Okay I put the executable jar file on my desktop and tried it like that now and I got the error message: `no main manifest attribute, C:\Users\Osiris93\Desktop\myApp.jar`. What does that really mean and how would I correct it – Osiris93 Jul 01 '16 at 18:52
  • @Osiris93 that means when you generated your jar file, you did not specify a main class. – Orin Jul 01 '16 at 19:29
  • @Orin2005 I saw that come up with further research but I have yet to find anything that helps me fix this problem. How would I specify the main class? Also this is happening with each application I create now so could this be a problem with my IDE – Osiris93 Jul 01 '16 at 19:38
  • @Osiris93 there is a manifest file inside of your jar file, that should have a line where you can specify your main class. An easy way to access this is renaming your jar file to a zip file (ex. rename myjar.jar to myjar.zip), and then going into the folder and editing the manifest file, then renaming back to jar file – Orin Jul 01 '16 at 19:42
  • @Orin2005 Okay I managed to open a window to view the contents of the Manifest file. This is what is inside it: `Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.4 Created-By: 1.8.0_51-b16 (Oracle Corporation) Class-Path: lib/jxl.jar lib/rs2xml.jar X-COMMENT: Main-Class will be added automatically by build`. I compared it to a working executable jar file manifest but I cannot add anything to the file. It's a read-only format – Osiris93 Jul 01 '16 at 19:54

0 Answers0