Eclipse gives warning on access restriction for jfxrt.jar classes - eclipse

I'm using eclipse kepler with java SE 1.8 jdk system library but when I use any javafx classes or methods eclipse gives a warning like Access restriction: The type 'TableColumn<?,?>' is not API (restriction on required library 'C:\Program Files\Java\jdk1.8.0_05\jre\lib\ext\jfxrt.jar').
I have tried adding an access rule to the system library to allow access for all jars in the library using the wildcard * but the warning is still there. Am also using maven for building project.
The code works but the warning is nagging and is affecting readability as I code. Any help is appreciated.
Edit: I also tried adding #SuppressWarnings("restriction") at the beginning of my classes but this still doesn't solve the unknown cause and hides all other restriction warnings that I may need to see

I'm able to get past this by reconfiguring Java library. For example, explicitly selecting Oracle JDK does the trick.

The easy way is to install e(fx)clipse - a plugin for Eclipse to support JavaFX:
Select Help -> Install New Software
Click Add button to add the following site:
Name: efxclipse
Location: http://download.eclipse.org/efxclipse/updates-released/1.2.0/site
Click OK
In the "Work with" dropdown list, select the recently added site "efxclipse"
Check the checkbox "e(fx)clipse - install" to install all components of this selection
Move to next steps to finish the installation
Restart your Eclipse. If it still doesn't recognize JavaFX library, restart it again.
Original information can be found here: https://www.eclipse.org/efxclipse/install.html#for-the-lazy

You can choose ignore in the following settings:
Windows -> Preferences -> Java -> Compiler -> Errors/Warnings
(Project) Properties -> Java Compiler -> Errors/Warnings
Use filter to find "Forbidden reference"
Forbidden reference (access rules) : Change it to "ignore"

Add an access rule to allow access to javafx/**.
See also this answer: https://stackoverflow.com/a/32062263/1060350
For all I can tell, this is a bug in Eclipse in my opinion. I also could not find a way to configure this globally in Eclipse, but you need to redo it for every project.
Navigate to Project settings, Build path, Libraries, JRE. Click on "Access rules" which should have "No rules defined" usually. Add a new rule: "Accessible", and enter the pattern "javafx/**".
This tells the Eclipse Java compiler that javafx.* is an official API that you are allowed to use, so the warning goes away.
Clearly, allowing access to javafx only is much better than ignoring the warning.
The reason why * did not work is because you did not read the wildcard definition. In the access rules, * only matches once, you need ** to match at any depth. I.e. * will allow access to javafx.SomeClass but not not javafx.scene.SomeClass...

Add an access rule for javafx.
Right click your project > Properties > Java Build Path > Libraries tab, then:
Expand JRE System Library
select Access Rules, click Edit... button
click Add...
choose Resolution: Accessible
set Rule Pattern: javafx/**
click OK
click OK

Related

Not able to download Kotlin plugin from eclipse marketspace

I am using Eclipse Platform Version: Photon (4.8) as my IDE.
I want to use kotlin in the same IDE, so I was trying to get it from the market space. But I am not able to download it . I tried two options.
My Network Connection Active Provider is native (window -> preferences -> Network Connections). I am able to find the Kotlin plugin but failed to download it saying that Authentication is needed.
My Network Connection Active Provider is manual(window -> preferences -> Network Connections).I have provided the authentication details for http and https. Here I am not even able to open the market space.
What is the solution for this?
Please take a look here how to do that. Go to Eclipse Marketplace, search for Kotlin.
If that doesnt work, you can still try the "Install New Software" that will do the same as explained down bellow **.
** Another option is to drag and drop (this is like a shortcut for the option above), here are the steps, just be sure you have the Eclipse Marketplace Client like the print bellow indicates.If so, you just need to drag and drop the button to your Eclipse IDE and that's it, follow the steps, next, next, next...
Continuing:
Add this line
-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4
to the end of your Eclipse config.ini and try again. Keep Active Provider Native. If it doesn't work, chance Active Provider to Manual and uncheck Socks, then try again.
After you copy and paste that line, please restart Eclipse (It starts with an '-' sign, just to be clear: -Dorg.eclipse...
If that doesn't work too, then the last option is to change Active Provider to Direct and try again.

Eclipse is saying "Missing builder" and there's no way to configure it

I'm trying to configure my projects to build with jdk 1.6. The problem is that when I removed 1.7 from my computer, my projects show up as having "Missing builder (org.eclipse.vjet.eclipse.core.builder). And trying to build them shows "The specified JRE does not exist"
There's no option to configure which JRE to use in the builders, when I select the one that says missing, "Edit" is greyed out.
How can I fix this so my project can build?
Stack Overflow won't let me post images directly, so here are the links to them, as hosted on imgur.com:
The Missing Builder comes from not having VJet installed. You can disable or remove the reference to it from the shown Property Page, or just install VJet. The other you might resolve by going to the Installed JREs preference page and making sure all of the values are correct, and then fixing any existing launch configurations (Run->Run Configurations...) that may be pointing to JREs that aren't around any more (such as by changing them to use an Execution Environment instead of a specific JRE by name).

Eclipse Indigo "Save Actions" are not being applied

I'm new to Eclipse and downloaded the following version:
Eclipse Java EE IDE for Web Developers.
Version: Indigo Release
Build id: 20110615-0604
[edit] Eclipse Platform Version 3.7
I have edited Java > Editor > Save Actions to do the following: Remove trailing white spaces on all lines, Correct indentation
When I save the .java file, those actions are not applied... is this a bug?
Found this that might be related: https://bugs.eclipse.org/bugs/show_bug.cgi?id=350475
Assuming that this relates to JavaScript files, then the related Eclipse bug could be helpful.
The problem (as I've just experienced) is that you can edit the JavaScript -> Save Actions preferences via the context menu when editing a JavaScript file, but the actions will not be run.
The solution is to right click on the project containing the .js file, and select Configure -> Convert to JavaScript project.
The bad news is that this will then will also enable Eclipse's not-so-great JavaScript validation, therefore telling you that libraries such as moment.min.js are broken.
Well for those of you who have found this topic... I did find 2 solutions, no thanks to Eclipse, other than the fact that it is open source and people can write plugins.
Eclipse Platform Version 3.7
AnyEdit - plugin that does it for you when you Save file (I believe this is what eclipse SHOULD be doing)
Go to: Window > Preferences. Then under General > Keys. Make sure drop down for Scheme: is Default and enter 'remove trailing' in the filter. You should then see "Remove Trailing Whitespace" under the command column. Bind it to your own key command.
The only drawback to #2 is that you have to actually press the key binding while editing the file, kindof like a cleanup action.
Too bad Eclipse hasn't taken the approach that ALL file types should be configurable in this way... sometimes I miss TextPad.
Old question, but at least for newer Eclipse versions there's a better solution: Go to the project properties, then to Project Facets. If it tells you that your project isn't in faceted form yet, then convert it. Afterwards (or if it already was faceted), just enable the JavaScript checkbox.
I had the same issue with Eclipse 4.4 (Luna) and this fixed it for me, the save actions are now executed on save.
Adding to jlh's answer, I also had to configure the JavaScript include path of the project to enable save actions. Before that even a manual "Clean Up ..." from the source menu wouldn't work.

documentation missing in eclipse

I'm new to eclipse/java Mobile development and all the rest of the keywords.
I have just downloaded the eclipse pulsar package, and installed it, i also downloaded the 'java me sdk 3.0' and installed it and linked it in eclipse. now i can create a new midlet and i'm using the splash template as a start.
now i typed: g.drawString(...) and i have like a string argument which is supposed to be the string to display. and other three integers.
Now the problem is that there's no documentation at all. it's like you have to guess each argument is what.
I'm sure there's something called documentation right? but i don't what where is it's the sdk ? is it eclipse? where can i fix that?
even the 'string' type i couldn't find it's documentation.
EDIT:
now in my installed jres i have only jre6, though i also have installed jdk1.6.0 but it's not appearing i added it now...
But the main thing here, is that i had to download something called 'sun java wireless toolkit' which suggested to download the new feature 'sun_java_me_sdk-3_0-win.exe'. and i did, when i installed it i have a new section 'window->preferences->javame' which also contains missing configurations.
but there's a section in it called 'device management' (meaning the device that i need to work against, like standard hansets configurations) each with a set of jars. And very few jars have javadoc location set.
i know where the javadoc is now, but it's not covering all the jars i'm working with.
so to recap: i think i'm working against swt sdk and i need to link the libraries taht i'm working against to their corresponding javadoc. but not sure since it's not supposed that 'Graphics' class or 'string' class be used from this sdk and not the default java sdk 1.6.0?
i think i'll take this day to try to fix all this and really understand what libraries i'm working with and if i can download the rest of the javadocs and use them.
if it didn't work i'll go with netbeans. they say it's much easier to deploy
I did install netbeans, and the documentation is working. i saw inside netbeans that they are integrating the 'Java_ME_platform_SDK_3.0' but i don't know from where they provide the javadoc.
I have a simple walkaround that fix this problem. Just go to the library setting, you will see the javadoc of cldc11api.jar is missing, give it the same location as midp21api.jar, restart eclipse. Hope this work for you.
I don't have first-hand experience with Java ME development in Eclipse, but I will tell you how javadoc hookup works in Eclipse and you can investigate further.
Go to Window -> Preferences -> Java -> Installed JREs. You should find your Java ME install listed here.
Select it and hit Edit.
Expand various jar nodes under JRE system libraries. You will see source attachment and javadoc location.
If you don't see a location listed under javadoc, select that tree entry and hit Javadoc Location button to edit the location.
For me, using Java SE, I see location specified like this: http://java.sun.com/javase/6/docs/api/
It is possible that Eclipse simply doesn't know where to find Java ME javadoc. If you know the location, you can specify it in the above dialog. This could be a local or a remote URL.
If the location is specified and appears correct, the problem could be with network connectivity. If you are behind the proxy, make sure that it is correctly specified under Window -> Preferences -> General -> Network Connections.
my question is close to this question, you can refer to
Attach Javadoc to Eclipse for Java ME
anyway
Konstantin Komissarchik has also answered correctly to how you set the javadoc location.
Now the problem is with the 'Java_ME_platform_SDK_3.0', anyway through setting manually the configurations of javadoc location, igot it working after i restarted the eclipse with -clean argument.

Eclipse CDT Does not track macro defines correctly

In the build settings I have it define DEBUG when in the debug build configuration, so that I may make my code do separate things depending on which type of build it is.
However in Eclipse it darkens out the parts of the code which are excluded by the preprocessor, and this doesn't keep up when I change the setting (whether I'm currently building debug or release). So, I have a bunch of code which is perpetually darkened out, and the Eclipse indexer and other helpful features don't work inside of those areas.
How to fix? Has anyone else encountered this?
Update: Still having this issue. I eventually abandoned my unit-test build configs and simply put that functionality into a command-line switch. Just so that I could get indexing to work while I write my unit tests.
You have to set the option "Build configuration for the indexer" to "Use active build configuration" in the projects C/C++ indexer preferences. Open the properties panel for the project, go to c/C++ General and Indexer and enable project specific settings and change the radiobutton on the bottom to "Use Active build configuration".
Of course you can also set this in the global properties panel of Eclipse to change this setting for all projects.
Go to your project's Properties, then go to C/C++ General -> Paths and Symbols -> Symbols. Add your defines there and it will work.
If you want to change the defines for your system based on build configuration, you need to do as dgrant said here: "Project properties and select C/C++ General -> Paths and Symbols then select the Symbols tab", but you need to make sure you have the correct configuration selected at the top of your window. Also be sure when you add the symbol to the list that you DON'T check the "add to all configurations" checkbox.
If you want your correct set of symbols to be parsed by CDT in your editor, you'll also need to make sure you have the correct build configuration active as well. To do that, right-click on your project and select Build Configurations -> Set Active -> and select the build configuration you want to make active. CDT will now parse all the files as if this build configuration were active instead, using the global symbols you defined in the last step.
There is a problem I've seen with every version of Eclipse where it doesn't always decide to rebuild your index files immediately. To get it to do so, you can either start a build (the build doesn't actually have to complete), or you can right-click on your project and go to Index -> Rebuild. Both cause an immediate re-indexing to occur. You shouldn't need this, however. I can confirm that simply changing the build configuration as described in step 2 above will cause an #ifdef I have in my code which checks for a symbol defined only in one of my build configurations to immediately become greyed-out or un-greyed-out, as it should.
Check provider: -> C/C++ General -> Preprocessor Include Paths, Macros etc. -> Providers -> CDT Managed Build Settings Entries. It should be enabled.
Check if defined symbol is in entries of this provider.
Indexer is optional.
My satisfactory solution has been to move away from Eclipse to editors with a working libclang plugin: Sublime Text, Vim.
For an intelligent IDE for C/C++, one probably can't go wrong with XCode or MSVC.