Java compilation error

i am on red hat Linux .

package hiveudf;
import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text;
public class lowercaseudf extends UDF {
    public Text evaluate(final Text s) {
        if (s == null) { return null;}
        return new Text(s.toString().lowerCase());
        }
        }
}
# javac -classpath /usr/hdp/2.6.5.0-292/hive2/lib/*:/usr/hdp/2.6.5.0-292/hadoop/*:/usr/hdp/2.6.5.0-292/hadoop-mapreduce/* lowercaseudf.java
lowercaseudf.java:7: error: cannot find symbol
        return new Text(s.toString().lowerCase());
                                    ^
  symbol:   method lowerCase()
  location: class String
1 error


I think the correct Java method for lowerCase() is:

toLowerCase()

Maybe you can try:

 return new Text(s.toString().toLowerCase());

I think the main problem is obtain in this code where this code have put.

 if (s == null) { return null;}
        return new Text(s.toString().lowerCase());

i agree,
toLowerCase() and not lowerCase().

Can't find symbol and in this case it's pointing to the method name lowerCase() means that this method does not existe.

gulatisneha56, you need to add more value than that to be a valued member here at unix.com. Most posts like yours are interpreted by members here as a precursor to spamming the site.

Caution is advised :slight_smile: