Unresolved compilation problems -- can't use .jar files that I have created

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2012-11-14T04:43:03Z Indexed on 2012/11/14 11:00 UTC
Read the original article Hit count: 478

Filed under:
|
|
|

I created a few .jar files and am trying to access them in another application - I have tried to use both Eclipse and IntelliJ and experience the same issue:

java.lang.Error: Unresolved compilation problems: 
    The import com.XXXX.XXXXXXXXX.project2 cannot be resolved
    The import com.XXXX.XXXXXXXXX.project2 cannot be resolved
    BeanFactory cannot be resolved to a type
    Author cannot be resolved to a type
    AuthorFactoryImpl cannot be resolved to a type
    Author cannot be resolved to a type
    Author cannot be resolved to a type

I have been using Maven during this process and the jars compile fine. I have included them on the file path using both the Maven .pom file and directly assigning them. I also have unassigned the direct file path and left the reference in Maven and vise versa -- no difference.

See below .jar file class info:

file structure:

Author.java

BeanWithIdentityInterface

Books

Subject

ie:

Interface:

package com.XXXX.training;

/**
 * Created with IntelliJ IDEA.
 * User: kBPersonal
 * Date: 11/5/12
 * Time: 3:16 PM
 * 
 */
public interface BeanWithIdentityInterface <I> {

    I getId();
}

Author.java:

package com.XXXX.training;

/**
 * Created with IntelliJ IDEA.
 * User: kBPersonal
 * Date: 10/25/12
 * Time: 12:03 PM
 */

public class Author implements BeanWithIdentityInterface <Integer>{

    private Integer id = null;
    private String name = null;
    private String picture = null;
    private String bio = null;

    public Author(Integer id, String bio, String name, String picture) {
        this.id = id;
        this.bio = bio;
        this.name = name;
        this.picture = picture;
    }

    public Author (){}

    @Override
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public String getBio() {
        return bio;
    }

    public void setBio(String bio) {
        this.bio = bio;
    }

    @Override
    public String toString() {
        return "\n\tAuthor Id: "+this.getId() + " | Bio:"+ this.getBio()+ " | Name:"+ this.getName()+ " | Picture: "+ this.getPicture();
    }
}

implementing Servlet:

package com.acentia.training.project3.controller;

import com.acentia.training.*;
import com.acentia.training.project2.AuthorFactoryImpl;
import com.acentia.training.project2.BeanFactory;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created with IntelliJ IDEA.
 * User: kBPersonal
 * Date: 11/11/12
 * Time: 6:34 PM
 *
 */
public class ListAuthorServlet extends AbstractBaseServlet {

    private static final long serialVersionUID = -6934109551750492182L;

    public void doProcess(final HttpServletRequest request, final HttpServletResponse response) throws IOException {

        final BeanFactory<Author, Integer> authorFactory = new AuthorFactoryImpl();

        Author author = null;
        if (authorFactory != null) {
            author = (Author) authorFactory.getMember(5);
        }

I can't pull the Author class. Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about java-ee