4 Replies Latest reply on Oct 6, 2008 12:55 AM by 843785

    Batch file problems

      Good day!
      I am kind of new in Java. Sorry for any obvious things I may ask - I am still learning.

      I am trying to compile file with .bat file and getting an error.

      "The system cannot find the path specified"

      and somehow when it command prompt runs this .bat file it shows me labs1.java.java file in the end.
      Where this second extension .java comes from? What am I doing to get this kind of result?

      This is output that I see in command prompt:

      " G:\dir1\Java\projects>"C:\Program Files\java\jdk1.6.0_05\bin\javac.exe" -classp
      ath classes -d classes G:/dir1/Java/projects/src/java112/labs1/lab1.java.java
      The system cannot find the path specified. "
        • 1. Re: Batch file problems
          Sounds like a typo in the .bat file. Try just getting rid of the extra .java.
          • 2. Re: Batch file problems
            Thank you for responding.

            When I need to compile with Batch file (if my Batch file called mybat.bat - do I need to type
            'mybat myfile'
            'mybat myfile.java' ?

            I can see now that when I type mybat myfile.java - I end up with 2 .java.java at the end

            but if I type only one - then I see only one .java extension but unfortunately my program still says

            G:\myFolder\Java\projects>"C:\Program Files\java\jdk1.6.0_05\bin\javac.exe" -classp
            ath classes -d classes G:/myFolder/Java/projects/src/java112/labs1/Lab1.java
            The system cannot find the path specified.
            • 3. Re: Batch file problems
              Dude, I have no idea what you're talking about.

              If you want to compile a java file for MyClass, you'll have a file MyClass.java with the source code in it, and you'll type
              javac MyClass.java
              If you want to execute a batch file called MyBat.bat, you type
              If that batch file is used to compile your java code, then it will contain a line that looks like the javac line above.

              I suggest you forget batch files and start at the beginning and follow the directions exactly:

              • 4. Re: Batch file problems
                I would be glad to do it without batch files but our instructor likes them and requires us to use them.
                I actually found some other solution for my question - I was not able to make my first example working. But found some working example and modified it.

                Thank you for an effort anyway.

                Take care