I'm developing part of an Eclipse plug-in. Currently the IDE is saying that packages such as org.eclipse.ui can't be resolved.
I have correctly added org.eclipse.ui to the plugin.xml as dependencies required, as you can see in this picture:
As you can see the packages are listed but have the small red x symbol that indicates that something is wrong. If I try to select one of those names and try to go to declaration and such the IDE cannot find the package.
The IDE I'm using is an Eclipse Neon RCP, freshly installed on my Ubuntu system. AFAICT these packages should come with eclipse itself, if not
how can I install them?
Note I previously used an older Eclipse RCP version to write the code. I'm positive that I did not have to install any special package for development. However I had some other issues and I decided to switch to Neon.
Check the Target Platform is valid (in the 'Preferences' in 'Plug-in Development > Target Platform).
The target platform definitions are part of the workspace and might become invalid when you upgrade.
It is generally a good idea to use a separate target platform rather than the default 'Running Platform' as it gives you more control over which plug-ins are available and is less likely to become invalid during upgrades.
Related
I'm going through this difficulty, I'm new to using this technology. Before formatting the machine, this project was running perfectly, I backed up everything and formatted. Now that I try to import the project into the software I come across some errors.
I performed the import through Maven->existing maven projects, the build runs, but returns the following errors:
Error in pom.xml file.
Some maven dependencies are missing.
Build path specifies JavaSE-11 execution environment. There are no
JREs installed in the workspace that are strictly compatible with
this environment.
The compiler compliance specified is 11 but a JRE 17 is used.
Please,look at the prints:
Since then I have been trying to resolve these issues, I have checked the versions of java, jre, jdk and the like. I managed to partially solve the jre problem but after some time I had conflicts again, but involving maven dependencies I didn't get any success.
Honestly I don't understand the reason for the errors, I kept the same computer settings before formatting, that is, I installed the versions that were before.
I would suggest to look into the preferences for the installed JDKs/JREs for your workspace. You can find those settings via Preferences -> Java -> Installed JREs. There you can see which JREs are configured to be used by the IDE for your projects (in general).
Then, please also take a look at the Execution Environment category below that preference node. There you can define which JRE should be used for which execution environment. Your project seem to require a JavaSE-11 environment. When you select that environment from the list, you will see which installed JRE the IDE will use to fulfill that JavaSE-11 requirement of the project.
I would also run a Maven -> Update Project---, since the dependences that are marked in the pom.xml file seem to be just fine, so probably a broken download of those dependencies, but also hard to say without the exact errors being mentioned.
Does the version of Eclipse affect the version of code? Suppose, developers are using different version of Eclipse for same version of code with same version of JDK. Will it cause any issue?
No, the version of Eclipse does not matter.
Eclipse has extensive configuration for exactly which version of Java you are targeting. For example see the 'Java > Compiler' settings in the Preferences, and the 'Compiler Settings' in the Properties for a Java project.
You can also tell Eclipse which JRE/JDKs you have installed (see the 'Java > Installed JREs' page in the Preferences). You can run your code using any of these JREs, this is completely separate from the version of Java you are using the run Eclipse itself.
You do need to run a version of Eclipse which understands the version of Java you want to use. So for Java 13 you need to use at lease Eclipse 2019-12.
Of course newer versions of Eclipse contain more tools for helping with Java development and more bug fixes so using an up to date version is recommeneded.
Eclipse is simply an IDE (Integrated development environment). It combines debugging, compiling and other convenient tools for development. on the other hand, the Java code itself is separate, and you don't necessarily need eclipse to write the code. In fact, a simple text editor is enough. All you need is a file with a java extension (Example: hello.java).
It depends on what users share. I'm assuming you're using some sort of SCM, in which case the same project (fully shared) on different versions of the IDE can possibly lead to annoying situations.
There would be no issues in general, as far as producing the code is concerned, except in situations where some versions of IDEs don't support the required Java version (or other features). But I see this more as the user being affected rather than the project/code.
Here's what you should keep in mind:
Keep IDE project configuration files (such as .project, .settings, .classpath) ignored by your SCM system
All Java configuration should be based on a build tool. Use Maven/Gradle, etc, and any modern IDE will be able to create a project from its config file. The IDE would derive local configuration files which should not be sent back to shared repositories
This way, all developers are free to use whatever IDE (and whatever version) without causing interference, and CI tools will work off build tools' configuration as well.
I am running Eclipse Luna (4.4.1) under Ubuntu 14.10 (Utopic Unicorn) and have a project that uses annotation processing to validate certain forms in the code and generate utility code. In eclipse the code is not being generated.
First, the processors work perfectly with javac. Second the processors DO run in Eclipse. If I alter them to throw exceptions Eclipse reports that. Also if I provide the processors with malformed code (such as a getter/setter pair with different types) it reports the error properly (red squiggles, proper error message, whole nine yards).
No code appears in .apt_generated nor are class files generated.
I've tried disabling them and re-enabling them, starting a new project, tried it on a fresh install of Eclipse, changing the project version from 1.7 to 1.8 and back again, tried batch mode and not batch mode, changing the .apt_generated directory, double checked the permissions on .apt_generated, probably a few other things that I can't recall.
At this point I'm just running javac separately and thinking about making this our first Apache Ant or Maven project if that would help but I'd rather not quite at this juncture.
Anyone have any luck with code generation within Eclipse? Anything else to do or check?
Verify your project is set to actually use APT, as shown in https://www.eclipse.org/jdt/apt/introToAPT.php. Be aware those are project settings, not workspace preferences.
Make sure your potentially generated code is not deleted by some other part of your workflow. E.g. a second processor cleaning the directory that a first processor generated into.
Check that you are using a JDT and not a JRE both for running Eclipse as well as building your project.
Verify that org.eclipse.jdt.apt.core is part of your Eclipse installation, as that is the actual annotation processor integration for the JDT.
Verify your processor has a correctly filled file META-INF/services/javax.annotation.processing.Processor, pointing to the right class implementing the processor. Eclipse may ignore it otherwise.
That being said, I have used different annotation processors (like butterknife for Android) in Eclipse over the years and didn't run into such problems.
I had a similar problem with the AutoValue annotations not being processed with Eclipse 2019-3 with OpenJDK 11 as target runtime. In the Eclipse "Error Log" panel I saw this error:
java.lang.Exception: java.lang.UnsupportedClassVersionError:
javax/lang/model/element/ModuleElement has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Eclipse was running on an old Java 8 installation as indicated by Help -> About Eclipse IDE -> Installation Details -> Configuration. In my case, Eclipse found the JRE to run on on the PATH environment variable, see here. I forced Eclipse to use the OpenJDK 11 installation by adding the -vm argument to the Eclipse.ini:
-vm
"C:\path\to\OpenJDK\bin\server\jvm.dll"
I am getting this in my plugin perspective. I get a generic menu istead of specific items e.g. action, etc.
(source: sourceforge.net)
My "Preferences / Plugin development / Target platform" looks like :
(source: sourceforge.net)
When I go to edit it looks like :
Is this similar to this thread?
I just figured out what was the problem.
I was using an external target platform to run my plugins, where I had installed only the basic plugins.
After I installed the sources org.eclipse.platform.source_2.1.0 and org.eclipse.platform.win32.source_2.1.0 also on the target platform, the manifest editor in the PDE was working normal again.
(to be adapted to your Eclipse version)
Also confirmed in this more recent thread:
Your target platform (and the default will be your own eclipse install) needs to have the source bundles (which provide the schema files used by these menus).
i.e. if I installed the runtime version, I will only get Generic in the menus but if I install the SDK version I will get real elements.
Thank you very much for the answer.
I "Add" source file to the platform (Preferences / Plugin development / Target platform) and got all menus!!
I am trying to build an Eclipse application that would work with a linux/motif installation target. However, this seems not to be possible even though the export option is available in the product export wizard.
I've checked the content of the delta pack and indeed, the packages for linux/motif are missing. After checking the downloads page for eclipse 3.4 at:
http://download.eclipse.org/eclipse/downloads/drops/R-3.4-200806172000/index.php
I see that even though there is an Eclipse version marked for Linux/motif, it is marked as Testing only. Additionally, there is no delta pack for this target.
Has anyone been successful building an RCP application targeting linux/motif? Would it work if I download this testing only version of eclipse and copy the missing plugins?
We have a similar issue. We are building Eclipse applications and one of our platforms is Solaris 10 x86 which was supported for a short time as an early access build in 3.2 and dropped. I believe 3.2 and 3.3 supported motif so your best bet may be to revert to an older version of Eclipse. I develop in 3.4 and when we do the Solaris specific release we switch back to 3.2, it is usually about 10 minutes of changes to fix everything for the prior version. Usually it is removing #overides in a few locations and changing a function or two that Eclipse no longer uses.
The other thing you can do is get the Linux/Motif package for Eclipse, and install it on a Linux box running Motif. Check out your project on that Eclipse machine and export it there. I tried out VirtualBox (a free Virtual Machine from Sun Microsystems) it should make this easy for you.