Maddening Java Compiler Error (StdIn)

Discussion in 'Mac Programming' started by j.drake.hoffman, Aug 20, 2009.

  1. j.drake.hoffman macrumors newbie

    Joined:
    Aug 20, 2009
    Location:
    right here
    #1
    hello all,

    so I have an issue with getting some of my java programs to compile. with certain files that i have already written (and been graded on) and know contain no syntax errors, I am getting a compiler error that appears to mean that I do not have StdIn in the same directory as the java file. I am confused by this bc they most definitely are.

    2 important notes: upon starting Dr. Java (sorry, I'm relatively new to java--only one semester under my belt) I get an odd error message--I suspect somehow this is due to an incorrect installation (?). something is not as it should be at least... And second, all of these were written on a windows machine (I'm a recent convert). I'm just confused why the programs that should work don't.

    any and all help would be useful! any and all constructive comments are welcome, and please ask questions if it will help.

    thank you in advance!

    btw, somehow my previous account was gone, so i had to sign up again..... I'm not as new as the info would have me appear.
     

    Attached Files:

  2. parapup macrumors 65816

    parapup

    Joined:
    Oct 31, 2006
    #2
    The error you highlighted in yellow (Class file has version 50, should be 49) means that you compiled the In.java file using java compiler from a later version of JDK and you are now trying to use it when compiling dependent Java files using a previous version of the compiler.

    So make sure all java files and class files they depend upon are compiled with same version of the compiler and that error will go away.
     
  3. j.drake.hoffman thread starter macrumors newbie

    Joined:
    Aug 20, 2009
    Location:
    right here
    #3
    I'm slightly confused. are you saying I need to update my JDK, or i need to use an older one?
     
  4. parapup macrumors 65816

    parapup

    Joined:
    Oct 31, 2006
    #4
    Doesn't matter as long as you use one single version of the JDK to compile all your Java files.

    So gather all your java files and compile them using whatever latest JDK version is installed on your system.

    I don't know the details of your setup but from what I can tell you have some .class files (may be you got them somewhere or compiled them in a different environment) that were compiled with later version of the JDK and you have some of your own java files that depend on those class files which you are compiling using a older version of the JDK.

    So if you have the source for all the Java files - just delete all .class files and recompile them on one JDK version. If you only have .class files for few classes then find out which version of JDK was used to compile them and then make sure you use the same version to compile your java sources.
     
  5. j.drake.hoffman thread starter macrumors newbie

    Joined:
    Aug 20, 2009
    Location:
    right here
    #5
    you are now officially my personal hero! lol. everything appears to be working perfectly!

    should there be any reason to be alarmed by the startup error message?
     
  6. parapup macrumors 65816

    parapup

    Joined:
    Oct 31, 2006
    #6
    Glad to be of help.

    That error is DrJava error parsing the configuration file - nothing alarming about it. You can open the configuration file and remove the offending line that it shows in the error dialog OR preferably just ignore it and deal with the minor annoyance.
     

Share This Page