Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Can't get classes in Referenced Libraries recognized.(I have 2 external jars and I have checked them; the contain the classes that I want to import and use, but for some reason the eclipse editor still has my references underlined in red.)
Can't get classes in Referenced Libraries recognized. [message #1692236] Tue, 14 April 2015 12:44 Go to next message
Earl Hodil is currently offline Earl HodilFriend
Messages: 4
Registered: April 2015
Junior Member
I have 2 external jars and I have checked them; the contain the classes that I want to import and use, but for some reason the eclipse editor still has my references underlined in red. What am I doing wrong?
Re: Can't get classes in Referenced Libraries recognized. [message #1692271 is a reply to message #1692236] Tue, 14 April 2015 16:48 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3071
Registered: July 2009
Senior Member
More details are needed to help.
Re: Can't get classes in Referenced Libraries recognized. [message #1692386 is a reply to message #1692271] Wed, 15 April 2015 12:25 Go to previous messageGo to next message
Earl Hodil is currently offline Earl HodilFriend
Messages: 4
Registered: April 2015
Junior Member
What details do you need?
Re: Can't get classes in Referenced Libraries recognized. [message #1692403 is a reply to message #1692386] Wed, 15 April 2015 13:28 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 04/15/2015 06:25 AM, Earl Hodil wrote:
> What details do you need?

Explain what you mean by "I have checked them". Do you mean that you've
used Build Path to integrate them into your project?

Incidentally, you'll likely be sorry to have integrated them using the
Build Path -> Libraries -> Add External JARs button. This puts
computer-specific paths into the .classpath file. Sharing your project
with someone else (committing it to a version-control system, etc.) will
be a disaster. Always integrate your libraries (JAR) dependencies using
Maven, Ivy, Gradle or, if not using those, make a lib subdirectory in
your project, move copies of the JARs there, then integrate using Build
Path -> Libraries -> Add JARs.

This may give you enough information to proceed or, I hope, enough
information to see what Eric's asking about in your project.

Cheers
Re: Can't get classes in Referenced Libraries recognized. [message #1692442 is a reply to message #1692403] Wed, 15 April 2015 17:35 Go to previous messageGo to next message
Earl Hodil is currently offline Earl HodilFriend
Messages: 4
Registered: April 2015
Junior Member
Thanks, that told me what I needed to know.
Re: Can't get classes in Referenced Libraries recognized. [message #1829079 is a reply to message #1692442] Wed, 24 June 2020 20:11 Go to previous messageGo to next message
Ko Bo is currently offline Ko BoFriend
Messages: 1
Registered: June 2020
Junior Member
Is it fixed with adding jar files under lib directory and referencing it again. I too tried the same, but it doesn't work for me.

Can anyone help me pls ?
Re: Can't get classes in Referenced Libraries recognized. [message #1829080 is a reply to message #1829079] Wed, 24 June 2020 20:16 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3830
Registered: July 2009
Senior Member

Are the classes in the jar matched, from the top level, with the directory structure in the jar? e.g. com.example.MyClass would need to be in com/example/MyClass.class with the "com" directory being at the top level of the jar, not contained in something else.

Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Can't get classes in Referenced Libraries recognized. [message #1832323 is a reply to message #1692403] Wed, 16 September 2020 10:44 Go to previous message
Sreenivasan Nagarajan is currently offline Sreenivasan NagarajanFriend
Messages: 1
Registered: September 2020
Junior Member
No luck yet.

I created a sub-folder 'lib' underneath the project folder and copied the external JAR files in there ( related to JSON ). Still getting an error "The type org.json.JSONArray is not accessible" with the red cross mark in Eclipse IDE. This is after adding the JAR files via 'Build Path -> Configure Build Path -> Libraries -> classpath -> External JAR files...". Screenshot attached herewith.

I will attempt to created a Maven project in the meanwhile.

Any support to resolve this issue will be much appreciated.

Thanks!
Previous Topic:Unable to update Eclipse Plugin
Next Topic:eclipse打不开
Goto Forum:
  


Current Time: Sat Sep 19 23:10:51 GMT 2020

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

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

Back to the top