1

I am compiling a file which makes a call to my getPdbFile method in my utils class. I receive the following error:

*method getPdbFile in class utils cannot be applied to given types;
            utils.toFileNoApp(new java.io.File(preInDir,aId+".pdb"),utils.getPdbFile(aPdbId,aChain));
                                                                         ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length*

However, in my utils class, I have two versions of the getPdbFile method, one of which takes two Strings as arguments. Can someone help me understand why I still get this error? The methods are:

  public static String getPdbFile(String pdbId) throws Exception{
    ...
  }

  public static String getPdbFile(String pdbId,String chainId) throws Exception{
    ...
  }

I have searched through a few other posts that give very similar error messages but the situations I found appear different from my problem.

NiceStats
  • 63
  • 7
  • 3
    it seems to me the code you posted is not enough to find the error. For a good question, you should try to eliminate as much code as possible (e.g. the `getPdbFile` method bodies, other methods in the class, other statements in the erroneous method...) I suspect that after doing so, the error will be apparent to you. If you use version control, you should have no problem rolling back your changes. If you find the error, and the solution could be useful to others, please share it here! – Silly Freak Aug 05 '14 at 17:13
  • maybe you are compiling against old class files? If you are using eclipse, try to clean your projects, otherwise delete your .class files and recompile everything. – Colin D Aug 05 '14 at 17:13
  • My understanding is that the method call in the file I'm compiling *is* calling the static method appropriately because the call `utils.getPdbfile(String string1, String string2)` is formatted as `class.method(args)`. The dupe. answer I was pointed to is over my head. I appreciate the fact that my error may be due to an intricacy of how Java is built. I appreciate that Jarrod R. is efficient at binning incoming questions where they strictly belong and that's how SE works but I am a beginner and I suspect my question could be answered directly with a couple sentences of individual attention. – NiceStats Aug 05 '14 at 17:21
  • thx for the suggestion Silly Freak. I agree the method bodies didn't look useful. When I look at this problem, all I see as relevant are the method signatures and the call to utils.getPdbFile(). Thanks to Colin D for your suggestion. I did already try recompiling utils.java first. I am doing this in Terminal. I'll check classpaths... maybe something wrong there. – NiceStats Aug 05 '14 at 17:24
  • 1
    That's not a duplicate of that other question. Voted to re-open. – Eran Aug 05 '14 at 17:34
  • @NiceStats your question was binned bc you do not use the convention of strictly writing all `ClassNamesStartingWithUpperCaseAndInCamel`. I too was deceived. Do note that the Java Syntax Coloring expects ClassNames as well on SO! – Antti Haapala -- Слава Україні Aug 05 '14 at 17:41
  • Are you sure you have recompiled the utils class? – Antti Haapala -- Слава Україні Aug 05 '14 at 17:43
  • @AnttiHaapala, thank you for the explanation ... good note. Makes total sense that Jarrod R. would not have thought I'd make such a basic mistake. This is all someone else's code which I inherited for a project. The code looks very clean and organized so a beginner like me forgot the ClassNamesConvention you are talking about. This error is rampant throughout his code. And (2) yes I have recompiled the utils class, but in fact, removing the utils.class file from the directory does *not* change the error I am getting... strange. – NiceStats Aug 05 '14 at 17:50
  • 1
    So I think that the `utils.class` comes elsewhere then... – Antti Haapala -- Слава Україні Aug 05 '14 at 17:52

0 Answers0