简体   繁体   中英

How to Import an External .class File in an Eclipse Java Project

I am trying to include a .class file through an import in a .java class I am creating. I need the .java class to look the same as what I need to deploy on the application server. I have created a directory structure to put the Context.class file in.

在此处输入图片说明

I updated the build path by using "Add External Class Folder..." and selected the "oracle" directory containing apps>fnd>common.

在此处输入图片说明

However, Eclipse still can't find the Context.class file referenced in the import.

在此处输入图片说明

What am I doing wrong?

You need to select the classes ( C:\\Users\\badams\\java\\classes ) directory instead of the oracle directory when using Add External Class Folder... .

You should provide the root of the directory that represent your java package structure.

As an alternative, you can create a jar archive with the contents of the C:\\Users\\badams\\java\\classes directory and add that archive as a jar dependency as well.

You can use for this purpose the builtin SDK jar utility. Please, change you current directory to C:\\Users\\badams\\java\\classes and run from a command prompt or PowerShell terminal something like:

jar cvf oracle-fnd.jar *

Then add the generated archive to your project as usual.

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