7 Replies Latest reply on Dec 11, 2005 6:55 PM by 796440

    Programs will not compile that have seperate classes

    807590
      I am trying to compile a program which has a seperate class, but it wont compile, it cant find the other class. I am compiling in the correct order, and I have tried re-compiling programs with seperate classes that I have done before, and they now wont compile. I tried compiling my program on my friends computer and it compiled fine.
      I am using jdk5.0 update 6 on Windows XP Pro
      Any help will be much appreciated
        • 1. Re: Programs will not compile that have seperate classes
          796440
          It would be better if you posted the actual error message, but I'm guessing it's a classpath issue.

          Post your directory structure: Where the .java files are, what directory you're in, and what the exact error message is.

          Are you doing this at the command line or in and IDE?
          • 2. Re: Programs will not compile that have seperate classes
            807590
            The error message I am getting is "cannot find symbol"
            symbol: class PhoneEntry
            location: class PhoneBook

            All my .java files for this program are in the same folder:
            C:\Documents and Settings\David Raine\Desktop\Java\Phonebook

            I am doing this from the command line

            I tried to compile a program with seperate classes that I have successfully compiled before, and it wont compile now.
            • 3. Re: Programs will not compile that have seperate classes
              796440
              Assuming both classes are not in any package:
              javac -classpath . Class1.java Class2.java
              
                OR
              
              javac -classpath . *.java
              • 4. Re: Programs will not compile that have seperate classes
                807590
                That still doesnt work, it comes up with an extra error message now:
                "error reading PhoneEntry.java; error in opening zip file"

                my two classes are PhoneEntry.java and PhoneBook.java

                PhoneEntry needs to be compiled before PhoneBook
                PhoneEntry compiles fine, just when it tries to find PhoneBook it appears it cannot find the created PhoneEntry.class file
                • 5. Re: Programs will not compile that have seperate classes
                  796440
                  That still doesnt work, it comes up with an extra
                  error message now:
                  "error reading PhoneEntry.java; error in opening zip
                  file"
                  Zip file?

                  It sounds like you have some bogus zip file in your classpath.

                  Did you try the exact command I posted?


                  my two classes are PhoneEntry.java and
                  PhoneBook.java

                  PhoneEntry needs to be compiled before PhoneBook
                  That doesn't matter. Javac will take care of that automatically.


                  PhoneEntry compiles fine, just when it tries to find
                  PhoneBook it appears it cannot find the created
                  PhoneEntry.class file
                  All I can guess at is that you're doing this:
                  javac -classpath .;something.zip *.java 
                  and something.zip either doesn't exist or is corrupt.
                  • 6. Re: Programs will not compile that have seperate classes
                    807590
                    I did the exact command you posted, I dont know why it is trying to open a zip file. I searched for a zip file in the directory and there is not one.
                    I have tried reinstalling the JDK and it still wont compile. Thanks for the help so far. Its not the end of the world because java still works for me in Linux, I would just like it to work for me again in Windows.
                    • 7. Re: Programs will not compile that have seperate classes
                      796440
                      I'm just about out of ideas.

                      Two things pop to mind:

                      * Is javac a .bat file that sets up some environment or classpath before invoking javac.exe? Is there a reference to a zip file there?

                      * In your ext directory (lib\ext under %JAVA_HOME% or %JDK_HOME% or %JRE_HOME%) is there a zip file?


                      Other than that, I'm stumped. Good luck.