1

I switched from Java JDK (and JRE) 7 to 6u45. For some reason, I can not run .jar files anymore. I changed the default program to run the .jar files to the new JDK's javaw.exe - but it doesn't work. Moreover, I tried using the new JRE's javaw.exe too - it doesn't work. In both cases I'm getting this error:

"Could not find the main class: Program will exit. C:\Users\Michael\Desktop\myJar.jar"

Rene Knop
  • 1,788
  • 3
  • 15
  • 27
None None
  • 147
  • 2
  • 3
  • 11
  • 1
    http://stackoverflow.com/questions/7617807/could-not-find-the-main-class-program-will-exit – Nambi May 27 '13 at 15:59
  • 2
    What error are you getting when you try to run the JAR from a command line using `java.exe`? – millimoose May 27 '13 at 16:01
  • I get no error when using the command prompt. I wrote it in Java 7, downgraded to Java 6, and reinstalled Eclipse and re-wrote it in Java 6. I don't know why the jar would't work. – None None May 27 '13 at 18:39

2 Answers2

1

Recompile it, with option -target 1.6, than you will be able to run on 6 too.

Pshemo
  • 122,468
  • 25
  • 185
  • 269
1

Sounds like you are not running java with the -jar argument.

try:

java.exe -jar C:\Users\Michael\Desktop\myJar.jar
arjunyg
  • 174
  • 1
  • 8