Dear Mr. Ted:
Please find details
Last login: Sun Apr 12 16:33:18 2015 from localhost
anand_vihar@Latitude-E5540:~$ cd hadoop-2.6.0
anand_vihar@Latitude-E5540:~/hadoop-2.6.0$ . .hadoop
anand_vihar@Latitude-E5540:~/hadoop-2.6.0$ cd etc/hadoop
anand_vihar@Latitude-E5540:~/hadoop-2.6.0/etc/hadoop$ sh hadoop-env.sh
anand_vihar@Latitude-E5540:~/hadoop-2.6.0/etc/hadoop$ java -version
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
anand_vihar@Latitude-E5540:~/hadoop-2.6.0/etc/hadoop$ hadoop version
Hadoop 2.6.0
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r 
e3496499ecb8d220fba99dc5ed4c99c8f9e33bb1
Compiled by jenkins on 2014-11-13T21:10Z
Compiled with protoc 2.5.0
>From source with checksum 18e43357c8f927c0695f1e9522859d6a
This command was run using 
/home/anand_vihar/hadoop-2.6.0/share/hadoop/common/hadoop-common-2.6.0.jar
anand_vihar@Latitude-E5540:~/hadoop-2.6.0/etc/hadoop$ cd ..
anand_vihar@Latitude-E5540:~/hadoop-2.6.0/etc$ cd ..
anand_vihar@Latitude-E5540:~/hadoop-2.6.0$ start-dfs.sh --config 
/home/anand_vihar/hadoop-2.6.0/conf

Error Messages

$javac MaxTemperatureMapper.java
symbol: class Mapper
MaxTemperatureMapper.java:8: error: cannot find symbol
public class MaxTemperatureMapper extends Mapper<LongWritable, Text, Text, 
IntWritable>
                                                 ^
  symbol: class LongWritable
MaxTemperatureMapper.java:8: error: cannot find symbol
public class MaxTemperatureMapper extends Mapper<LongWritable, Text, Text, 
IntWritable>
                                                               ^
  symbol: class Text
MaxTemperatureMapper.java:8: error: cannot find symbol
public class MaxTemperatureMapper extends Mapper<LongWritable, Text, Text, 
IntWritable>
                                                                     ^
  symbol: class Text
MaxTemperatureMapper.java:8: error: cannot find symbol
public class MaxTemperatureMapper extends Mapper<LongWritable, Text, Text, 
IntWritable>
                                                                           ^
  symbol: class IntWritable
MaxTemperatureMapper.java:15: error: cannot find symbol
    public void map(LongWritable key, Text value, Context context)
                    ^
  symbol:   class LongWritable
  location: class MaxTemperatureMapper
MaxTemperatureMapper.java:15: error: cannot find symbol
    public void map(LongWritable key, Text value, Context context)
                                      ^
  symbol:   class Text
  location: class MaxTemperatureMapper
MaxTemperatureMapper.java:15: error: cannot find symbol
    public void map(LongWritable key, Text value, Context context)
                                                  ^
  symbol:   class Context
  location: class MaxTemperatureMapper
MaxTemperatureMapper.java:25: error: cannot find symbol
            airtemperature = Integer.parseInt(line.substring(87,92));
            ^
  symbol:   variable airtemperature
  location: class MaxTemperatureMapper
MaxTemperatureMapper.java:28: error: cannot find symbol
        if (airTemparature != MISSING && quality.matches("[01459]"))
            ^
  symbol:   variable airTemparature
  location: class MaxTemperatureMapper
MaxTemperatureMapper.java:30: error: cannot find symbol
            context.write(new Text(year), new IntWritable(airTemperature));
                              ^
  symbol:   class Text
  location: class MaxTemperatureMapper
MaxTemperatureMapper.java:30: error: cannot find symbol
            context.write(new Text(year), new IntWritable(airTemperature));
                                              ^
  symbol:   class IntWritable
  location: class MaxTemperatureMapper
MaxTemperatureMapper.java:14: error: method does not override or implement a 
method from a supertype
    @Override
    ^
17 errors

Hope someone can advise. Look forward to hearing.
Thanks
Regards
 Anand Murali  11/7, 'Anand Vihar', Kandasamy St, MylaporeChennai - 600 004, 
IndiaPh: (044)- 28474593/ 43526162 (voicemail) 


     On Sunday, April 12, 2015 5:59 PM, Ted Yu <[email protected]> wrote:
   

 Can you tell us how you setup your project?
Do you use maven to build it ?
Please pastebin snippet of your code and the error you got. 
Cheers



On Apr 12, 2015, at 4:16 AM, Anand Murali <[email protected]> wrote:


Dear All:
I am new to hadoop2.6.0. I managed to set up and install Hadoop and Java 1.7. I 
wrote my first hadoop code with import statements of Hadoop class files. 
However when I try and compile the code, I get errors, which are reflective of 
the class files, which I suppose is not imported. I have run hadoop-env.sh 
successfully before dameon startup. Can somebody advise.
Thanks
 Anand Murali  11/7, 'Anand Vihar', Kandasamy St, MylaporeChennai - 600 004, 
IndiaPh: (044)- 28474593/ 43526162 (voicemail)


  
import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

public class MaxTemperatureMapper extends Mapper<LongWritable, Text, Text, IntWritable>

{

	private static final int MISSING = 9999;

	@Override
	public void map(LongWritable key, Text value, Context context)
		throws IOException, InterruptedException {

		String line = value.toString();
		String year = line.substring(15,19);
		int airTemperature;
		if (line.charAt(87) == '+') {
			airTemperature = Integer.parseInt(line.substring(88,92));
		} else
		{
			airtemperature = Integer.parseInt(line.substring(87,92));
		}
		String quality = line.substring(92,93);
		if (airTemparature != MISSING && quality.matches("[01459]"))
		{
			context.write(new Text(year), new IntWritable(airTemperature));
		}




	}


}
<?xml version="1.0"?>
<!--core-site.xml-->
<configuration>
	<property>
		<name>fs.default.name</name>
		<value>hdfs://localhost/</value>
	</property>
</configuration>

<?xml version="1.0"?>
<!-- hdfs-site.xml -->
<configuration>
	<property>
		<name>dfs.replication</name>
		<value>1</value>
	</property>
</configuration>

	
<?xml version="1.0"?>
<!--mapred-site.xml-->
<configuration>
	<property>
		<name>mapred.job.tracker</name>
		<value>localhost:8021</value>
	</property>
</configuration>

Attachment: .hadoop
Description: Binary data

Reply via email to