user2413035
user2413035

Reputation:

Import Class of a similar package

I'm now in a new project. There is the following folder structure:

* fsaapp-business
  - com.fsa.fsaapp.business.monitor
    > JenkinsStatBusinessService.java

* fsaapp-business-impl
  - com.fsa.fsaapp.business.stat
    > StatistikViewModel.java

* --> Project
- --> Package
> --> Class / Interface

Now I have this Interface:
JenkinsStatBusinessService.java

package com.fsa.fsaapp.business.monitor;

import com.fsa.fsaapp.business.stat.StatistikViewModel;


public interface JenkinsStatBusinessService {

    public String collectStatistics();

    public String getDurchschnittBisLetzterTag();

    public StatistikViewModel getBuildCounts();

}

Now the import of StatistikViewModel gives me this error:

The import com.fsa.fsaapp.business.stat cannot be resolved

I think this is because this Interface search *.stat in the fsaapp-business project, and not in the fsaapp-business-impl project.

So how can I import the StatistikViewModel out of the impl into the business?

Upvotes: 1

Views: 91

Answers (2)

Abhishek
Abhishek

Reputation: 882

use this:

import com.fsa.fsaapp.business.stat.*;

this must do the job..

Upvotes: 0

Duncan Jones
Duncan Jones

Reputation: 69339

Right-click on the fsaapp-business-impl project and select Properties. In the Project References tab, select your other project and click OK.

This will ensure your other project is on the library path and should allow you to resolve classes from that project.

Upvotes: 1

Related Questions