1

I am new to java or coding in general. I am currently taking a course for Computer Programming. For this final assignment I need to make a .jar program or game. I have decided to make a game but it does not execute like it does in an IDE. Thank you in advance for the help.

successful launch in the ide

launch as a .jar file

JonCode
  • 11
  • 1
  • It looks like your resources are missing. If you launch your application using the console then you can see any error outputs, and the command would look like this: `java -jar yourGam.jar`. If the errors do show that the images can not be found, then make sure they are placed in the same folder as your jar application, or make sure they are loaded correctly as shown here: https://stackoverflow.com/questions/15749192/how-do-i-load-a-file-from-resource-folder – sorifiend Apr 07 '22 at 04:10
  • 1
    If you see no errors on the console/terminal, then make sure that your code is not catching and hiding errors. make sure you always print out the error or stack trace. Without the error we really can't help much more. – sorifiend Apr 07 '22 at 04:14
  • Ok i just noticed something, it also happens in the ide but not consistently. It works most of the time but some launches dont show gui. Could this be the problem? I will learn how to make a stack trace and get it so I can show it to you. Thank you for the reply. I launched with a .bat file, it had no errors in the console.@sorifiend – JonCode Apr 07 '22 at 11:28
  • Take a look into [Maven][https://maven.apache.org/what-is-maven.html] it helps you to compile and package your applications. – Valerij Dobler Apr 08 '22 at 09:54

1 Answers1

0

Thank you for all the help, I have solved my own problem by adding a sleep timer to my gui from the main method and by default setting my gui to invisible, once the main method ran it set the gui to visible. Thank you again for all the help.

JonCode
  • 11
  • 1
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 07 '22 at 15:34