Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » [CLOSED]classes in jar files not accessible(Starting a new project and imports classes cannot be read in)
[CLOSED]classes in jar files not accessible [message #1837160] Sat, 23 January 2021 03:48 Go to next message
Jim Anderson is currently offline Jim AndersonFriend
Messages: 109
Registered: October 2014
Senior Member
This is bewildering to me. I have set up Eclipse projects many times and importing classes in jar files has never been a problem for me. I have looked at a number of possibilities, but the error condition persists. I have run out of ideas and I'm looking for help.

I have installed the Eclipse IDE for Java Developers, Version 2020-12 (4.18.0). I added a new project. As I typically do, I symbolically linked the src directory to my src directory on my development PC.

In the Package Explorer, I navigate to the source file I am working on. I double click and the source file is displayed in a editing window in Eclipse. Several of the import statements have errors because the jar files have not been added to the project.

Next, I point to my project in the Package Explorer and right click and select Properties and the Properties window for the project pops up. In the left column of the window, I select "Java Build Path" and then the "Libraries" tab for the Java Build Path. I click on "Classpath" and then I click on the "Add External JARS ..." button. I then navigate and click on the "jsoup-1.12.1.jar". I then add the "org.json.jar" external jar. In the library tab, I can see both of these jar files in the Classpath section. Then I click on the "Apply and Close" button.

In the Package Explorer, I can look at the "Referenced Libraries" under my project and both of jsoup and org.json jar files are displayed.

In the Package Explorer, I then right click on my project and select "refresh" to update my project.

These steps are a procedure I have done many times before with little trouble and when I have had trouble it was because I forgot a step or made a foolish mistake. Normally, I figure it out and then run my program.

But this time, after running through this procedure, my import statement shows an error message:

The type org.jsoup.Jsoup is not accessible.

and I have 5 other import statements with a similar message.

I am running on a Linux PC. When I check the eclipse job running on the PC, it is being run with my login id (jja). The paths to all the files in the project and the path to the jar files all lead to directories and files owned by me and with read/write permissions set properly. They should be accessible to the eclipse program that is running.

So, the jar files are seen by eclipse and they should be readable and accessible.

I think I'm doing everything correctly, but obviously, I am not. I feel like there is an obvious mistake, but I have been searching the internet and experimenting with this for hours and have made no progress.

It is getting late here, and I will pick up on this again in the morning. Suggestions are most welcome!!

Jim A.

[Updated on: Fri, 29 January 2021 18:08]

Report message to a moderator

Re: classes in jar files not accessible [message #1837166 is a reply to message #1837160] Sat, 23 January 2021 07:52 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
This is not a filesystem issue, but a Java issue. Google "Java The type is not accessible" and browse the results.

Is this the first time you've installed 2020-12? What version did you have before 2020-12?

The error message about "accessible" has to do with Java 9 modules. If your code only needs to be compiled with Java 8, then install a Java 8 JDK and set that as the compiler for your project. If you want it to use Java 9+, then you'll have to work on your module-info.java file, probably adding a "requires" statement.
Re: classes in jar files not accessible [message #1837170 is a reply to message #1837166] Sat, 23 January 2021 11:38 Go to previous messageGo to next message
Jim Anderson is currently offline Jim AndersonFriend
Messages: 109
Registered: October 2014
Senior Member

Thank you!

It is early morning here and I won't get a chance to try you suggestion for hours, but it is a reasonable guess that java version is the problem. I switched over to Java 11 months ago. Running multiple programs on multiple hosts, I ran into problems for a while. I thought I had them all cleared up and I put it out of my mind.

I did do a search on the internet and did not hit the java issue. I am not sure why. Maybe just too hasty.

I will work on this later today and hopefully close out this issue. My guess is that I have a number of jar files that need to be updated. I'm not sure what to do if I cannot find versions updated for Java 9+, but I will work about that later.

Regards,
Jim
Re: classes in jar files not accessible [message #1837217 is a reply to message #1837170] Mon, 25 January 2021 10:52 Go to previous messageGo to next message
Mark Smith is currently offline Mark SmithFriend
Messages: 82
Registered: September 2020
Member
Right click on your project and choose properties. Go to Java Build Path and there should be more specific information of the problem. Most likely you set the JDK to an Version which doesn't exist on the new System. If this doesn't help too, select your project and then use the menu entry Source->Clean Up .
Re: classes in jar files not accessible [message #1837430 is a reply to message #1837217] Fri, 29 January 2021 18:07 Go to previous message
Jim Anderson is currently offline Jim AndersonFriend
Messages: 109
Registered: October 2014
Senior Member
Status:

I ordered a book for Java 9+ and will work my way through. In the meantime, I have back tracked to Jave 1.8 so that I can keep my project moving forward. I hope to be done in the early spring and I don't want to use my time now to address Java 9+ issues.

I'm closing this thread.

Jim A.
Previous Topic:Eclipse's internal browser seems to identify as Internet Explorer
Next Topic:How do you exclude a package in an external JAR?
Goto Forum:
  


Current Time: Thu Apr 25 19:29:46 GMT 2024

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

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

Back to the top