Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » the import cannot be resolved(Adding a User Library: the import cannot be resolved)
the import cannot be resolved [message #1694801] Fri, 08 May 2015 03:14 Go to next message
Marlene Miller is currently offline Marlene MillerFriend
Messages: 6
Registered: May 2015
Junior Member
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.
Re: the import cannot be resolved [message #1694881 is a reply to message #1694801] Fri, 08 May 2015 16:13 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

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 #1694905 is a reply to message #1694881] Fri, 08 May 2015 23:25 Go to previous messageGo to next message
Marlene Miller is currently offline Marlene MillerFriend
Messages: 6
Registered: May 2015
Junior Member
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 ?



Re: the import cannot be resolved [message #1694906 is a reply to message #1694905] Sat, 09 May 2015 00:01 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

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.
Re: the import cannot be resolved [message #1694908 is a reply to message #1694906] Sat, 09 May 2015 00:42 Go to previous message
Marlene Miller is currently offline Marlene MillerFriend
Messages: 6
Registered: May 2015
Junior Member
project> Properties> Java Build Path> Libraries> Add JARs

At this point, the only things I can do is select the project or Cancel

If I select and expand the project,
the only things I can do is select .settings, src, .classpath or .project

There is no place on the Eclipse JAR Selection window to browse or navigate to a Windows folder.

Sorry, I am missing something. Thanks for your time.
Previous Topic:Archive for required library in project cannot be read
Next Topic:No java menu at preference option
Goto Forum:
  


Current Time: Tue Sep 29 23:59:44 GMT 2020

Powered by FUDForum. Page generated in 0.03331 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top