0

I wrote and compiled a java program and the resulting files are (HelloWorldSwing.java), (HelloWorldSwing.class) & (HelloWorldSwing$1.class) as shown in the image

The files are in a package called (start) as shown in the directory path. I tested the program using cmd and it works just fine. However, when I tried to create a .jar file it would create the file but the file won't open.

I separately tried to include the .java file alone, the .class(es) alone, and everything together.. Nothing would make the .jar work.

The .jar file WAS created, but here's what I wrote in the powershell anyways -

jar -cf Run.jar *.java

OR

jar -cf Run.jar *.class

OR

jar -cf Run.jar *.java *.class

In each of these cases, the jar file was created but it wouldn't run for some reason.

  • What version of java have you got installed? – Randomhero Aug 22 at 8:47
  • java version 1.8.0_111 – Fahd_19 Aug 22 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.