Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » The package xxx is not accessible
The package xxx is not accessible [message #1816053] Fri, 18 October 2019 07:59 Go to next message
Andrea Vt is currently offline Andrea VtFriend
Messages: 2
Registered: October 2019
Junior Member
Hello all

Sometimes I feel very stupid :-)

My last trials with Eclipse are more than 10 years ago and feeding search engines did not help me ...

Situation:
- New installed Eclipse 2019-09 (4.13.0) on Linux
- Minimal Java Project (Hello world) which runs perfect

Then I added jsch-0.1.55.jar (downloaded directly from jcraft) to the project
- typing "import com.j" shows suggestions (I think that shows, that the archive is visible)

But even if I import com.jcraft.* or something more specific it ends in an error. E.g. "The package com.jcraft.jsch.* is not accessible"

What did I forgett? What could be wrong?

Best regards and thank you in advance
Re: The package xxx is not accessible [message #1816066 is a reply to message #1816053] Fri, 18 October 2019 12:40 Go to previous messageGo to next message
Emmanuel Chebbi is currently offline Emmanuel ChebbiFriend
Messages: 123
Registered: February 2018
Senior Member
Hi,

Welcome back to Eclipse IDE!

Andrea Vt wrote on Fri, 18 October 2019 09:59
I added jsch-0.1.55.jar (downloaded directly from jcraft) to the project

What did you do exactly? To be taken into account a library must be added to the project's classpath:

  1. Right-click on the project
  2. Build Path > Configure Build Path...
  3. Open the Libraries tab then click on either Add JARs... (if the JAR is located in the project's folder) or Add External JARs... (if the archive is located somewhere else)

See this article [1] for a demo.

You may also face issues related to Java 9+ (see this question on StackOverflow [2]) or wrong access rules (see this answer [3]). I think that the latter would cause a slightly different error message though.

[1] http://tech.bragboy.com/2016/01/quick-way-to-import-jar-in-eclipse.html
[2] https://stackoverflow.com/questions/52343704/how-to-make-an-internal-java-package-accessible-in-eclipse
[3] https://stackoverflow.com/a/24743070/10226142
Re: The package xxx is not accessible [message #1816101 is a reply to message #1816066] Mon, 21 October 2019 09:18 Go to previous messageGo to next message
Andrea Vt is currently offline Andrea VtFriend
Messages: 2
Registered: October 2019
Junior Member
Hello and thank you for your answer.

First - english is not my first language - so that could be a problem to express me correct
==================
EDIT later than the rest
- It is as it is - reinstalling Eclipse does not change the facht, that no include works
- jdk from sun did not work, so I changed back to open-jdk

I'm a little bit lost in space
Best regards Andrea

========================================

What I realised just now:
If I try "import java.awt.*;" I also have an uncompilable system -> "The package java.awt is not accessible.

Probably al the text below is not as important as I thougt a couple of minutes ago when i started typing :-)

I remove all and reinstall Eclipse on my mint-machine and if that don't brings up a better situation I make a trial using Windows ....

Till than - perhaps somebody has an idea what has gone wrong ....

========================================

Yes I've done all 3 steps below more than once and I triednit in different ways. So I also added the jar during creating the project. (Over the weekend at home with a very old version of Eclipse - sorry, I forgot to note the version - this gave me a compilable project)

I thougt that the fact that the Editor offers me the completion typing "import com.jcra..." signalizes, that I had done the stepps successfuly - I supposed that it is only a thing of the runtime


To make situation clearer and the discussion easier:
- I just created a new Java project called "Test3" - not choosen any "specials"

- I added a main class ch.andrea.test3.test3main just printing out "Hello world" - of course that runs perfect :-)

- Package Explorer - Test3 - context menu - Build path - configure build path - Tab libraries - select "Module path" - add external jars - jsch-0.1.55.jar
Of course the jar is now listed just oder the entry "JRE system library ..." and in the Test3-Project under "referend libraries"

--> The situation is exactly the same as described in the first post

[Updated on: Mon, 21 October 2019 11:28]

Report message to a moderator

Re: The package xxx is not accessible [message #1816488 is a reply to message #1816101] Wed, 30 October 2019 05:49 Go to previous message
Gheorghe Tudose is currently offline Gheorghe TudoseFriend
Messages: 1
Registered: October 2019
Junior Member
Had kinda the same problem here, "The package java.beans is not accessible".
The thing is I'm using openjdk 11 and having in mind they modularised the platform a while back I finally tried adding "requires java.desktop;" into module-info.java; that's because java.beans is included in the java.desktop module, said Google.
So now I have the module-info.java looking along the lines of:
module <MyPrettyModuleOrProjectName> {
exports <whateverIExport>;

requires java.sql;
requires java.desktop;
requires<whatever else you need>;
}
That did it.
I think here you can find more detailed info (see "7. Modules") https://www.eclipse.org/community/eclipse_newsletter/2018/june/java9andbeyond.php
Hth

[Updated on: Sun, 03 November 2019 21:20]

Report message to a moderator

Previous Topic:Open files in detached editors
Next Topic:Problem in connecting with Java
Goto Forum:
  


Current Time: Thu Apr 25 12:45:32 GMT 2024

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

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

Back to the top