简体   繁体   中英

Single Source File Reference on Eclipse Java Project

I'm using Eclipse and I have two projects (say A and B) written in Java. In project-A I want to add a reference to a single source file of project-B. When I build a jar from project-A, I want that class to be included in it. Is there a way to achieve this?

I want to add reference to a single source file so the following method does not work for me since it gives reference to a complete folder:

Java Build Path -> Source -> Link Source

Ok.... let me put it this way.........

When we don't use the import keyword, then we need to write the entire path of that class that we are trying to use in the code...

So its like this....

java.util.List<String> l = new java.util.ArrayList<String>();

that means we are giving the package name and then its class ........

So then there are 2 ways you can deal with it :

- Add the whole package into the project path .

- Or you can Copy-Paste that class into your project.

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