简体   繁体   中英

Cannot access class files from another package in Eclipse

I have found similar problems, and i applied all the suggested solutions, but none works so far. I may have overlooked something.I am working on Maven multi-module project. In one of the packages, one of the java files is trying to access class file in another package. Class file is an external dependency provided in a jar file, installed on local repository. Jar file is added in Java Build path-> Libraries under Maven Dependencies. It is even included in classpath variable. But when I try to declare package and access it, I get error

The declared package "net.java.swingfx.waitwithstyle" does not match the expected 
 package "com.giag.fo.application.utility"

I would really appreciate any suggestions. I have tried anything I could find. I am clueless now.

Here is the image to get better idea

use import instead of the keyword package. like :-

package com.giag.fo.application.utility;
import net.java.swingfx.waitwithstyle.*;

Instead of

package net.java.swingfx.waitwithstyle;

use

import net.java.swingfx.waitwithstyle.InfiniteProgressAdapter;

You can read more about package and import here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM