Eclipse Maven: “Cannot be resolved to a type” error

I am trying to build a simple sentence detector using OpenNLP 1.5.0. I am using Maven Eclipse for that. I downloaded "en-sent.bin" model file from and placed it inside src/main/resources folder. My pom.xml file is as follows.

<project xmlns="" xmlns:xsi=""





Inside 'src/main/java' folder I have created "dk.research.new1" package and its file contains the following code.

package dk.research.new1;

public class App{
    public void SentenceSplitter() {
        SentenceDetector sentenceDetector = null;
        InputStream modelIn = null;

        try {
           modelIn = getClass().getResourceAsStream("en-sent.bin");
           final SentenceModel sentenceModel = new SentenceModel(modelIn);
           sentenceDetector = new SentenceDetectorME(sentenceModel);
        } catch (final IOException ioe) {
        } finally {
            if (modelIn != null) {
                try {
                } catch (final IOException e) {}
        String sentences[]=(sentenceDetector.sentDetect("I am a student. I am learning programming. I like java language."));
        for(int i=0; i<sentences.length;i++) {

I get the following error messages in file.

  • SentenceDetector cannot be resolved to a type
  • InputStream cannot be resolved to a type
  • SentenceModel cannot be resolved to a type
  • SentenceDetectorME cannot be resolved to a type
  • IOException cannot be resolved to a type

Why am I getting these errors? I tried Project->Clean but I can't get rid of these errors. What do I have to do to get this solved?


In your POM in <dependencies> section add:


And then, you have to import classes in Java file before line public class App add:



Need Your Help

UIImagePickerController: Check if returned image is in landscape or portrait?

ios objective-c cocoa-touch uiimagepickercontroller landscape

So, the UIImagePickerController does not support landscape orientation. However, there is a portion of application where it is essential that the image that comes from the controller is recognized ...

Access singleton class methods in blackberry 10

c++ singleton blackberry-10 blackberry-cascades

I have implemented Singleton class method hpp and cpp like the following

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.