|
Re: the import cannot be resolved [message #1694881 is a reply to message #1694801] |
Fri, 08 May 2015 16:13 |
|
On 05/08/2015 06:41 AM, Marlene Miller wrote:
> Would you please explain why this error is occuring:
> The import com.tandem.ext.enscribe.EnscribeFile cannot be resolved.
>
> Test2.java
> import com.tandem.ext.enscribe.EnscribeFile;
>
> public class Test2 {
> __public static void main(String args[]) {
> ____System.out.println("Test2");
> __}
> }
>
> I added com/tandem/ext/enscribe/EnscribeFile.class to mylib.jar:
> 0 Thu May 07 20:37:18 MDT 2015 META-INF/
> 73 Thu May 07 20:37:18 MDT 2015 META-INF/MANIFEST.MF
> 27255 Fri Sep 26 12:10:40 MDT 2014
> com/tandem/ext/enscribe/EnscribeFile.class
>
> I added User Library called userlib to the eclipse project. I added
> External JAR mylib.jar to userlib:
> Package Explorer
> Test2
> __src
> __JRE System Library
> __userlib
> ____mylib.jar
> ______com.tandem.ext.enscribe
> ________EnscribeFile.class
> ____META-INF
> ______MANIFEST.MF
>
> When I change the import to
> import com.tandem.ext.enscribe.*;
> the error changes to a warning The import com.tandem.ext.enscribe is
> never used.
Some background? Why are you using the User Library feature?
Typically, such third-party JARs (libraries) are consumed via Maven
repositories or by adding directly to your project.
Assuming you're not using Maven, I would suggest creating a lib
subdirectory off the root of your project, dropping the HP JAR(s)
inside, then using Build Path -> Libraries and Add JARs...
If you use Add External JARs... then your .classpath file will be
screwed up with paths proprietary to your computer and you will not be
able to share the project with others. (You may not care about this.)
|
|
|
|
Re: the import cannot be resolved [message #1694906 is a reply to message #1694905] |
Sat, 09 May 2015 00:01 |
|
On 05/08/2015 05:25 PM, Marlene Miller wrote:
> The context for my question and confusion is this - - - - - -
> I am using Eclipse on a Windows7 laptop to debug a Java servlet on a
> remote server.
>
> I will add the servlet source code to the Eclipse project. The servlet
> imports classes that are contained in a third party .jar. Therefore I
> also need to add the third party .jar to the project.
>
> On the remote server, the third party .jar resides in a directory
> outside the Web application and Web server directories.
>
> I am not sure when Eclipse wants a third party jar to be added as-is or
> to be added into a User Library.
> - - - - -
>
> Correct, I am not using Maven.
> I am having a problem after following your suggestion to add a subfolder
> (lib) in the project folder and copy the .jar to lib, because I never
> get to a place where I can select/specify the .jar.
>
> project> Properties> Java Build Path> Libraries> Add JARs
> Choose the archives to be added to the build path.
> Should I select .project ?
No, just navigate using the file browser to the subdirectory where
you've dropped the JAR in question, click to select the JAR then click OK.
|
|
|
|
Powered by
FUDForum. Page generated in 0.07480 seconds