Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsThe package xxx is not accessible
https://www.eclipse.org/forums/index.php/mv/msg/1101004/1816053/#msg_1816053
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]]>Andrea Vt2019-10-18T07:59:50-00:00Re: The package xxx is not accessible
https://www.eclipse.org/forums/index.php/mv/msg/1101004/1816066/#msg_1816066
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:
Right-click on the project
Build Path > Configure Build Path...
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)
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.
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
]]>Andrea Vt2019-10-21T09:18:02-00:00Re: The package xxx is not accessible
https://www.eclipse.org/forums/index.php/mv/msg/1101004/1816488/#msg_1816488
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>;