I have spent the past few days trying to find a solution to my problem. I am trying to launch an Eclipse RCP using the 3.x compatibility layer using the bndtools launcher via a bndrun file.
I am aware of the solution which involves placing bndtools.runtime.eclipse.applauncher in the list of run bundles in order to get an E4 application to start and that there are ways to migrate an E3.x application to E4. We would like to maintain programmatic control over the Rich Client Platform for the time being so migrating to an XMI file for laying out the Workbench is not ideal at this time.
I created a plug-in project which builds using bndtools. To my knowledge I have included all of the necessary bundles to run the application and have followed several examples (as an aside, most of the OSGI examples I found were console-based).
Because I wasn't seeing the RCP load up (we have an RCP plug-in which extends the IApplication interface and our project structure is still Activator based) I was initially at a loss as to why this wasn't working but adding -osgi-console= to the run properties did provide some additional information:
Using -runfw: org.eclipse.osgi
The final lines are the following:
# framework=org.eclipse.osgi.launch.Equinox#59fa1d9b
# registered launcher with arguments for syncing
# will wait for a registered Runnable
Additionally, the plug-in I am using to test with is marked as STRTD and the bundle that is using it is also marked as STRTD whereas most other bundles are marked as ACTIV, which I assume is also part of the problem. I have tried to force bundles to start by including a line to start several bundles (following other examples) but have run into issues where the console will error stating could not load or find main class for org.eclipse.core.runtime when trying to include that in the list of activated bundles.
Googling (and even Binging) have not appeared to produce a solution which explains how to set up an Eclipse 3.x application to run using a bndrun file. What am I missing? Most recently I tried the following properties:
-runproperties: \
osgi.os=win32,\
osgi.clean=true,\
osgi.console=,\
eclipse.product=org.eclipse.sdk.ide,\
osgi.arch=x86_64,\
osgi.ws=win32,\
equinox.use.ds=true,\
eclipse.application=org.eclipse.ui.ide.workbench
I assume that if the actual test bundle I am using would actually activate that I should also be able to find the application ID set in the plugin.xml file and to use that instead. Trying to activate that plug-in also results in a could not find main class error even though I specify a Bundle-Activator in the bnd file. That Activator does not appear to be started since I have it set to print to the console and nothing is printed. I assume that since the bundle is in the STRTD state that it did not start.
Any help with this would be appreciated.
Edit:
As an update, adding org.apache.felix.gogo.runtime and org.apache.felix.gogo.shell did result in my test plug-in's activator getting started. Curiously the plug-in it is dependent on, though, moved from STRTD to RSLVD.
Other discussion has indicated that we might have to manually start an Eclipse instance using EclipseStarter?
The following Github repo contains using an example with bndtools and Eclipse 3.8. It uses an adapted bndtools.runtime.eclipse.applauncher inside /cnf/eclipse_common_3.8/bndtools.runtime.eclipse.applaunch-0.1.0.jar see the 3.8 bnd launch config also include here example.aspectj/example.aspectj.bnd.app/run/launch_org.eclipse.osgi_3.8.x.bndrun. This was (beside the Aspect stuff demoed in the repo) the smallest set of bundles to startup an Eclipse app successfully with bnd.
Related
I'm building a Minecraft plugin that passes the functions to a Lua interpreter, and after exploring all other options for doing hooks without manually writing everything (i.e. using a built in function from Spigot that lets me easily intercept every event handler; I am not able to use arguments with this, making it worthless for my case) I've discovered my best option is AspectJ.
I installed the latest version of IntelliJ, then installed the relevant plugin and followed the instruction to "add a library containing aspectjrt.jar to my project" (I added org.aspectj:aspectjrt:1.9.19 through build.gradle, and added 'include 'aspectjrt:1.9.19'' to my settings.gradle). It also says to add a facet, but I can't do that due to the error "Requires plugin 'com.intellij.aop' to be installed." I can't find any reference to a dedicated AOP plugin for IntelliJ, in fact I'm told the AspectJ plugin is supposed to add support for it. There seems to be no other reference to this error online.
What am I doing wrong?
I originally asked another question regarding the specific issue of not being able to create an .exe file, but after trying three different methods that gave me three different errors, I've come to the conclusion that the problem has something to do with the use of JavaFX itself.
Long story short, I wrote a small program on Apache NetBeans 11.3 that uses JavaFX for the GUI. It has a class named Main that extends Application and another one called Launcher that does not, and whose purpose is to call Main.main(args).
I have tried in vain to create a runnable file of some sort for this program using NetBeans.
Under the Packaging project properties, I ticked Compress JAR File, Build JAR after Compiling, and Copy Dependent Libraries. Under Deployment I ticked Enable Native Packaging Actions in Project Menu and Keep JavaFX artifacts on Compile Classpath if not present by default. These are the same settings I found in every tutorial, although the tutorials I found were for version 8 or older of NetBeans.
When I try the standard "Clean and build" option, attempting to run the resulting .jar from the command prompt returns the following error:
Graphics Device initialization failed for : d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
Along with a ton of other lines I can copy/paste here if it's deemed necessary. I've tried the solutions I found online, but none of them worked.
I tried creating a Maven project, but the error returned is no main manifest attribute. Fixing this error by adding the location of the Launcher class to the MANIFEST.MF file (Main-Class: orionindustries.passwordalgorithm.Launcher) results in a different error: Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application.
I installed Inno Setup to try to create an exe file, but I get yet another error: typedef class com.sun.javafx.tools.ant.FXJar cannot be found
using the classloader AntClassLoader[].
I tried enabling the Switch Project to JavaFX Deployment Model setting under Deployment in the Project properties, but it says the JDK doesn't support JavaFX and doesn't allow me to select any JDK when I try to solve it.
I've no idea what else to do. In the previous (now-deleted) question someone mentioned JDK 14 would come with a packaging tool, but that's not a real solution to my problem, it's just using another tool for something that NetBeans is supposed to be able to do (and even then, there's no guarantee that it'd work). Either I'm screwing up massively, or NetBeans has serious bugs that somehow went unreported.
I want to create an Eclipse RCP from our collection of already existing Eclipse plugins.
We have the pecularity that in our RCP we want the user to be able to open ("import") Eclipse projects (we distribute some of our features in bundles which come in the form of Eclipse projects. These should be registered in the workspace because a model server scans for the opened projects and loads them). Also, when I open files via File->open an exception is thrown from our internal editors: File opening intentionally only is possible if you load an imported resource.
For the moment, I have gotten the RCP to work by depending on org.eclipse.core.resources and org.eclipse.ui.navigator.resources. Thereby, I can import complete Eclipse projects. However, I am unsure[1] this is the correct/"intented" way of doing it (e.g. the navigator view is lacking icons per default) should I rather use the CNF?
The main thing is, we have to support loading/importing Eclipse projects in our RCP. Your answer is even helpful if you know other RCPs which allow to import Eclipse projects.
Regards
SuperUser
[1] http://wiki.eclipse.org/RCP_FAQ#Is_the_resources_plug-in_.28org.eclipse.core.resources.29_considered_part_of_the_Rich_Client_Platform.3F
If you are using org.eclipse.ui.navigator.resources then you are using the CNF (it's org.eclipse.ui.navigator).
The link you have is pretty outdated information, using the Eclipse Resources support in an RCP application will work fine (our product does it). And then if you want to package the application to work either as RCP or in an IDE environment you are one step closer. Also, despite what the link you provided says, don't be afraid to use stuff in org.eclipse.ui.ide if you need them. All you really need to be concerned about is to make sure you are only using classes that are actual Eclipse API, if you do that, then everything will work on future Eclipse versions. Anything that's public is Eclipse API unless it's marked in the Javadoc that it's not intended to be used by clients.
You should not be using the Resource Navigator as that has been deprecated and is not as general as the CNF.
As far as importing and exporting Eclipse projects with RCP, our product does that as well and it works fine.
I would say you are on the right track.
I'm trying to load OSGi Bundles from an arbitrary folder at runtime in order to use them in my Eclipse RCP Application. The following steps I have done so far to achieve that objective:
Create a new Plugin
Acquire the BundleContext from the Plugin Activator
Install a Bundle via the install() method of the BundleContext
Start the acquired Bundle via the start() method
After these steps the Bundle is in status ACTIVE and can be retrieved via any BundleContext. My problem is that the bundle cannot be retrieved via PluginRegistry.getAllModels(). Apparently the PluginRegistry is not listing to changes in the BundleContext. I need find a way to register my Bundle in the PluginRegistry. This is important because the PluginRegistry is used by already existing software parts, e.g. the Manifest Editor.
The PluginRegistry has no method to register Bundles. Is there a way to add them to the registry?
The PluginRegistry class is a development time class supporting the PDE. Does this mean that your RCP application includes the PDE and is used (in part) for plugin development? If this is true, then you will need to work out now PDE works (which is something I don't know much about). I recommend having a look at the classes in the org.eclipse.pde.runtime plugin (not the internal classes). You should be able to work out with the debugger and looking at the code how to add a plugin to the PDE runtime. If you have further questions about that, use the PDE newsgroup at the Eclipse site.
If your RCP application does not include plugin development, then there is no need to work with the PluginRegistry at runtime, so I'm confused by your question. Perhaps you could elaborate more?
During the development of Acceleo, we stumble upon this problem too as we need to let the user deploy Eclipse plugins, located in its workspace, in the running Eclipse instance (we also need to uninstall those plugins after that). Since Acceleo is open source, you can have a look at our source code on github.
I won't detail everything here but you should find what you are looking for around the line 880 and after around the line 752. The file linked is our utility class for manipulation of Eclipse plugins in the workspace and Eclipse bundles in the running instance so you can find there pretty much anything needed to handle your problem.
Small warning, when we are deploying on the fly an Eclipse plugin located in the workspace, we deactivate its plugin.xml. Since most of the Eclipse tools are just looking at the plugin which are contributing to their extension point at a given moment and since they are not listening dynamically to the installation / uninstallation of Eclipse plugins contributing to their extension point (which can be done like this) they may keep references to contribution from plugins that we will uninstall later which can create problem. This behavior is explained in detail line 775 in the first linked file.
Regards,
Stephane Begaudeau
I have an Eclipse RCP app running on Java 6. When I try to run the product configuration from within Eclipse, it silently terminates almost immediately. No error is reported in the console. I've tried setting breakpoints in the IApplication and in the Activator, and neither are reached.
I know I don't have much specific information here, but can anyone give me any pointers on where I might start looking to diagnose the problem?
I wasn't able to locate the runtime/.metadata folder, but this very helpful post directed me to add -consoleLog and -noExit to my runtime arguments, which dumped the errors to the console. Configuration problems.
Have you checked the logs in runtime/.metadata folder?, Also make sure to validate all plugins in the runtime. Having them as a dependency doesn't necessarily mean they are added to the runtime. This is probably the biggest gotcha when launching an rcp app.
I experienced this problem after migrating my RCP app from 3.7 to 4.2. The solution for me was to delete to runtime-product.product directory and re-run.