Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.NoSuchMethodError + Stata 15.1

    Hi,
    It is my first time on this website, recently I had the error regarding java in Stata 15.1 , on the Stata 15 everything was fine and my code worked.
    but now it is not and gives me this error

    the error : java.lang.NoSuchMethodError: Method com.stata.sfi.DataFrame.dropVar(Ljava/lang/String;I)I name or signature does not match

    the code is :
    cap cd `csv_folder'
    local filelistA: dir . files "*.csv"

    foreach file of local filelistA {
    import delimited `file', varnames(1) encoding(UTF-8) clear


    drop var2 var 3 var4

    local dta_file = "`file'"+".dta"
    save "`dta_folder'\`dta_file'", replace
    }

    clear
    set obs 1
    g Var1=.
    save "`data_folder'\alldata.dta", replace

    I am not sure if the problem is produced by Java or by this version of Stata, (15.1), I have checked the java , its there and the version is 1.8.0_144
    I hope if there is a way to fix it

    Regards,


  • #2
    Perhaps the problem lies with
    Code:
    save "`dta_folder'\`dta_file'", replace
    The backslash character
    Code:
    \
    has meaning to Stata: it will prevent the interpretation of any following character that has a special meaning to Stata, in particular
    Code:
    `
    will not be interpreted as indicating a reference to a macro.

    But all is not lost: Stata will allow you to use the forward slash character in path names on any operating system, and on Windows will take care of doing what must be done to appease Windows.
    Code:
    . local prefix batch42
    
    . display "Q:\HOME\`prefix'_filename"
    Q:\HOME`prefix'_filename
    
    . display "Q:/HOME/`prefix'_filename"
    Q:/HOME/batch42_filename

    Comment


    • #3
      It could be a bug in one of Java classes installed with Stata (-import delimited- relies on Java), but this thread suggests to first check your installation with Stata's Installation Qualification Tool.

      Note you have also a bug in the command drop var2 var 3 var4 (extra space).

      William Lisowski The -save- command does not use Java, and neither does -drop-. Anyway, because of the bug in the -drop- command, the -save- command is never called. So it has something to do with -import delim-. If it's not an installation problem, it's probably a bug in -install delim- (or in the Java class that it calls), related to an uncommon problem in the CSV file.

      By the way, the Java installed with my Stata 15.1 is jre1.8.0_202, so maybe you don't have the last Stata update?

      Jean-Claude Arbaut
      Last edited by Jean-Claude Arbaut; 29 Apr 2019, 12:40.

      Comment


      • #4
        Dear @William Lisowski ,
        Thank your for your response,
        I though the backslash would be the reason, after the replacement it gives the same error.

        @Jean-Claude Arbaut the extra space in the drop command is removed and it also generate the same error. Knowing that the Current update level for Stata is : 21 Mar 2019, but the current version of Java is 1.8.0_144.

        Installation Qualification Tool can not be used in my case as i am using Stata from University.However the IT team said Stata and Java should work fine.

        Comment


        • #5
          Jean-Claude Arbaut Thank you for the explanation. I'm glad I qualified my answer with "perhaps". I'm too easily distracted by backslashes. :-)

          Comment


          • #6
            My installation (macOS) shows that as part of the updates I installed on March 3 2019 the Stata JRE /Applications/Stata/utilities/java/macosx-x64/jre1.8.0_202.jre was installed, although this is not documented in help whatsnew which only mentions the 18apr2018 upgrade of the JRE to version 8 update 162.

            I would show the response from StataCorp in the thread cited by Jean-Claude Arbaut to your IT team and ask that they run the Installation Qualification Tool as Stata Technical Services recommends.

            Comment

            Working...
            X