Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: java compilation error

  1. #1
    Junior Member
    Join Date
    Sep 2018
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java compilation error

    i am unable to compile this code on redhat 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

  2. #2
    Member
    Join Date
    Sep 2018
    Location
    Virginia
    Posts
    284
    My Mood
    Cool
    Thanks
    0
    Thanked 38 Times in 36 Posts

    Default Re: java compilation error

    It looks like you have one too many }'s. Also, standard practice is that class names should start with uppercase letters.

    Regards,
    Jim

  3. #3
    Junior Member tonya's Avatar
    Join Date
    Feb 2018
    Posts
    14
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: java compilation error

    # 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());
                                        ^
    The compiler is telling you that it can't find lowerCase(), try using toLowerCase()
    https://docs.oracle.com/javase/7/doc...#toLowerCase()
    Last edited by tonya; September 30th, 2018 at 08:32 AM.

Similar Threads

  1. Replies: 3
    Last Post: May 8th, 2014, 06:25 AM
  2. JAVA API : Compilation error
    By Roopali in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 26th, 2013, 05:39 AM
  3. Compilation error
    By gnarkill10 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 5th, 2012, 08:15 AM
  4. EJB COMPILATION ERROR(TANMAY SINHA)
    By Tanmaysinha in forum Web Frameworks
    Replies: 4
    Last Post: March 22nd, 2012, 10:58 AM
  5. Unable to execute the program (no compilation error)
    By Alexie91 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 16th, 2011, 02:39 PM

Tags for this Thread