0

I have struggled for almost 2 days now with my java. Since I'm taking a computer science class, we will have to start without programming in an IDE. First of all I had the problem with the "javac" command which I managed to solve, everything worked after that as programs ran in the console etc. But after starting up my computer today executing didnt work! How is that possible?

Information:

I have downloaded lots of java versions, but this is what kind of files I have:

  • In C:\Program Files\Java I have 4 folders: jdk1.7.0_01, jdk1.7.0_02,
  • jre6, jr7 In C:\Program Files (x86)\Java I have one folder; jre6

My environment variables:

My 'PATH' is in User variables for Administrator :

C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\;C:\Program Files (x86)\QuickTime\QTSystem;.;

While my CLASSPATH is in System variables:

.;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip

None of my friends in my class have the same problem as everything worked fine for them when they downloaded Java. I dont know what Ive done wrong, Ive download so many javas now (as you can see) and now this is taking all my time to fix. I'm seriously thinking about dropping this course as I wont be able to finish my first friggin task in Java-programming since I have to google all day to solve this...

Best regards.

adarshr
  • 61,315
  • 23
  • 138
  • 167
Dannzor
  • 11
  • 3

1 Answers1

1

You need to add the Java\jdk1.x.x\bin folder to the PATH Variable. Otherwise it won't work. Also, make sure that you are using the Console as the User for whom you set the PATH Variable. Greets

CyrillC
  • 557
  • 1
  • 3
  • 15
  • The error message is: C:\Users\Administrator\Desktop\Java Work>java Hello Exception in thread "main" java.lang.UnsupportedClassVersionError: Hello : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1 (Native Method) at java.lang.ClassLoader.defineClassCond (Unknown Source) at java.lang.ClassLoader.defineClass (Unknown Source) at java.security.SecureClassLoder.defineClass (Unknown Source) at java.net.URLClassLoader.defineClass (Unknown Source) at java.net.URLClassLoader§1.run (Unknown Source) at java.net.security.AccessController.doPrivileged (Native Method) – Dannzor Jan 20 '12 at 09:28
  • It seems like you compiled it with a newer version than you run it. i.E. you compiled it with JDK7 but run it with the JDK6... I once stumbled upon the same... here is what helped me [link](http://www.rune-server.org/runescape-development/rs2-server/snippets/354974-runesource-unsupported-major-minor-version-51-0-fix.html) – CyrillC Jan 20 '12 at 09:36
  • I solved the problem myself, so silly solution. A classmate installed a special command prompt on my computer, called "Console" and switched it out instead of my normal "cmd" in my program-bar. Seems I used that one by reflex, oh whatever. It worked when I did like CyrillC at last :) Thanks all and sorry for a semi-stupid thread. – Dannzor Jan 20 '12 at 09:50