8 Replies Latest reply: Jun 1, 2013 8:45 PM by La VloZ RSS

    Java cmd-line problem windows 8

    La VloZ
      Hii all :)

      I have a problem :(
      Compiling using javac works fine but excuting with java doesn't work.
      everything is good, Path and CLASSPATH !!!! and the folder conntain the class !!!!
      exemple :
      javac Main.java (Works good)
      java Main (Doesn't work)
      it tell me impossible to found the class or load it !!!!!!!
      if i execute the in the command line :
      java
      i see the java help !!!!!

      it works on windows xp but not on windows 8 !!!!!!, i searched on google but i didn't find anything !!!!!! :(

      can someone help please??
        • 1. Re: Java cmd-line problem windows 8
          962773
          Hi,

          Can you please send the value of your path and classpath from windows command promt?
          • 2. Re: Java cmd-line problem windows 8
            La VloZ
            CLASSPATH = "C:\Program Files (x86)\Java\jdk1.7.0_21\bin";"C:\Program Files\Java\jdk1.7.0_21\bin"
            Path = C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;"C:\Program Files\Java\jdk1.7.0_21\bin";"C:\Program Files\Java\jdk1.7.0_21\jre\bin"

            and my class in :
            C:\java\apprentissage\bin\Main

            when i execute :
            javac -d C:\java\apprentissage\bin\ C:\java\apprentissage\src\Main.java (it works)
            but :
            java C:\java\apprentissage\bin\Main (Doesn't work :'( )

            i repeat i have this problem only on windows 8 :( , on windows xp it works fine :)

            Edited by: La VloZ on 31 mai 2013 20:39
            • 3. Re: Java cmd-line problem windows 8
              EJP
              CLASSPATH = "C:\Program Files (x86)\Java\jdk1.7.0_21\bin";"C:\Program Files\Java\jdk1.7.0_21\bin"
              Both incorrect. There are no class files at either of these locations.
              java C:\java\apprentissage\bin\Main (Doesn't work :'( )
              Also incorrect. The argument to 'java' is a class name, not a filename.
              • 4. Re: Java cmd-line problem windows 8
                962773
                Add your current directory where .class file is present in CLASSPATH and then try to run it. I hope it will help your
                • 5. Re: Java cmd-line problem windows 8
                  baftos
                  Remove CLASSPATH completely! You should have no such environment variable.
                  • 6. Re: Java cmd-line problem windows 8
                    La VloZ
                    It's ok i found the solution :)
                    I must add in the classpath variable environnement the dot : classpath=.
                    Thank u all :)
                    • 7. Re: Java cmd-line problem windows 8
                      EJP
                      No, you don't have to do that at all. That's equivalent to not having one at all, as you were already recommended.

                      I suggest you read the documentation for the tools you are trying to use. Clearly you have never done so. Evidently you are relying on the Google search engine to complete your education. It isn't sufficient.

                      It is also impossible to understand why you post here at all, when you clearly don't even read the responses you get.
                      • 8. Re: Java cmd-line problem windows 8
                        La VloZ
                        The Class also called Main :)