How to make eclipse launch a program in the eclipse workbench from the command line? - eclipse

How do I make eclipse launch a program in the eclipse workbench from the command line?
Specifically, I would like to run a command from the shell that causes my eclipse instance (which is already open) to run a particular program. If there is no program to do this from the shell, is there some RPC API that eclipse provides to make such a program?
I do not want to make a plugin. It must be a separate process that controls eclipse.

Eclipse Remote Control seems that it might do the trick https://github.com/marook/eclipse-remote-control from the Read me file.
Introduction
Eclipse plug-in project which adds remote control features to eclipse.
Commands can be sent via the eclipse remote control client to a
running eclipse instance.
I have not tried it myslef but I ran into it trying to figure out how to write an ant task that triggers .launch file

First create a batch file and save it in a location.
For example if I want to invoke notepad , I will write in the batch as follows
start notepad
In eclipse, you can configure external tools.
Goto Run -> External Tools -> External Tools Configurations.
You will be presented with a Dialog box.
Now Click on the New Configuration Icon.
In the right pane of Window you can assign a configuration Name.
In the Location Text Box, Click on the "Browse File System" Button, and select the batch file you have created earlier.
In the Common Tab, uncheck "Launch In Background".
You can set this configuration in Favourites menu, by clicking the checkbox "External Tools" under Common Tab.
Click on Apply.
Now you can Run your required application. This is for Windows only. I don't have any idea of this for Linux Machines.

Take a look at Product Configuration
1º Create a new Product Configuration (Ctrl+N), and select "Use a launch configuration" (or another option, if it's more convenient) on the first page of the wizard.
2º In the Exporting section you should be able to export your product using the "Eclipse Product export wizard".
3º To run the product, follow this instructions
Hope it helps.

Not a complete answer, but here are some things I've come across with Eclipse:
In general, you can open Eclipse from the command line with something like:
java -Dosgi.requiredJavaVersion=1.5 -Dhelp.lucene.tokenizer=standard -Xms40m -Xmx512m -XX:MaxPermSize=256m -cp plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar org.eclipse.core.launcher.Main
That Main launcher takes an -application flag where you can pass what I think are plugins (not sure). I've typically used this to run Ant within Eclipse:
java -Dosgi.requiredJavaVersion=1.5 -Dhelp.lucene.tokenizer=standard -Xms40m -Xmx512m -XX:MaxPermSize=256m -cp plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar org.eclipse.core.launcher.Main -application org.eclipse.ant.core.antRunner -buildfile build.xml
I have no idea how to manipulate a running Eclipse instance, and I don't know if you can achieve your goals through an Ant script, but I thought these might be fruitful avenues.

Addition to ams' answer, marook's plugin just support very few commands.
open_file and execute_command with RUN/DEBUG/PROFILE
And marook also have a blog post about how to implement more command http://pielmeier.blogspot.com/2010/07/implementing-new-eclipse-remote-control.html
But as we all know, Eclipse plugin development is quite heavy weight.
So, I suggest just use execute_command with RUN by marook's plugin. The further function to Eclipse IDE, can be done by Eclipse EASE script engine. Write a light weight script and then RUN by marook's plugin, to avoid Eclipse plugin development.
More information about EASE can be found at:
https://opensource.com/life/16/2/how-use-python-hack-your-ide
There is also javascript script support:
https://git.eclipse.org/c/ease/org.eclipse.ease.scripts.git/tree/JavaScript%20Beginner%20Tutorial/02%20File%20IO/05%20Create%20sample%20project%20(using%20modules).js

Here you have a series of examples: http://www.rgagnon.com/javadetails/java-0014.html
Basically, you use:
Runtime.getRuntime().exec(command);

Related

How do I get the command-line for an Eclipse run configuration?

I have several JUnit run configurations in Eclipse that I need to replicate on the command-line in order to use a third-party analysis tool. So far I've just been writing the command-line manually by looking at the run configuration and writing the appropriate classpath and command-line arguments.
Eclipse's run configurations (normal, JUnit, or other) must ultimately boil down to a command-line anyway, so how and where do I find that?
I found a solution on Stack Overflow for Java program run configurations which also works for JUnit run configurations.
You can get the full command executed by your configuration on the
Debug tab, or more specifically the Debug view.
Run your application
Go to your Debug perspective
There should be an
entry in there (in the Debug View) for the app you've just executed
Right-click the node which references java.exe or javaw.exe and
select Properties In the dialog that pops up you'll see the Command
Line which includes all jars, parameters, etc
You'll find the junit launch commands in .metadata/.plugins/org.eclipse.debug.core/.launches, assuming your Eclipse works like mine does. The files are named {TestClass}.launch.
You will probably also need the .classpath file in the project directory that contains the test class.
Like the run configurations, they're XML files (even if they don't have an xml extension).
To elaborate on rob's answer.
Make sure you open the debug view. Steps to open it: Window -> Show View -> Other -> (Search debug) -> Open
Then do what he references:
Run your application
Go to your Debug perspective
There should be an entry in there (in the Debug View) for the app you've just executed
Right-click the node which references java.exe or javaw.exe and select Properties In the dialog that pops up you'll see the Command Line which includes all jars, parameters, etc
Scan your workspace .metadata directory for files called *.launch. I forget which plugin directory exactly holds these records, but it might even be the most basic org.eclipse.plugins.core one.

eclipsec.exe options/ command line usage?

Is there an exhaustive list of documented commands that I can use with eclipsec.exe?
Build Eclipse Java Project from Command Line
I see that we can build projects outside GUI. Is the command line powerful enough to control any other features inside eclipse GUI?
For example : Is it possible to launch a saved "Java Application" inside eclipse workspace from the command line directly?
Basically, I want to explore all options that I have on eclipsec.exe. I tried eclipsec.exe --help and eclipsec.exe -help to see if I can get some help but none of them work.
The Eclipse runtime options
- http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html
using p2 director to install/uninstall plugins
- https://wiki.eclipse.org/Equinox/p2/Director_application
- http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_director.html
There is also linked Question Build Eclipse Java Project from Command Line

STS (Spring Tools Suite) writes STS.ini any time I get updated, merging with my own configuration

To improve my STS performance I've added some parameters to STS.ini. But every time I update the tool, it puts its own configuration at the beginning of STS.ini file, relegating my configuration to the end, sometimes duplicating several parameters.
Is there another way to avoid this?
Now, everytime I update the tool I need to backup the file and check the parameters...
I tend to launch Eclipse and STS from the command line. I create a bunch of shell scripts, one for each variant of Eclipse/STS that I run. This ensures that every launch has precisely the arguments that I need.
For example, I have a bunch of scripts like this:
[21:09] ~/Eclipse
$ more eclipse_42.sh
Installations/Eclipse4.2.M6/Eclipse -data \
"/users/Andrew/Eclipse/Workspaces/workspace_42" \
-vmargs -Xmx1024M -XX:PermSize=64M -XX:MaxPermSize=256M
I like running from a terminal so that you can see what gets sent to sysout. And this could also be launched from a Finder window.
I run on Mac, but you could do something similar on Linux or Windows.
Just thought of another possible answer. I haven't tried this, but it could work.
Instead of doing "Check for updates", go to the install manager Help -> Install new software...
With the STS update site, select all the components that you want updated (except SpringSource Tool suite (required) and SpringSource Tool Suite Package (if you see it)).
I think it is these two components that alter the STS.ini. The only thing that I am not sure of is if it is at all possible to update individual components without updating that package.

Is it possible to add external command line tools to Netbeans?

Is it possible to use external command line tools in Netbeans?
Thank you.
After searching and searching and searching, this feature is just missing in netbeans although it would absolutely straightforward to implement and has been ask by user for 2 more than years...
Regards,
Stéphane
There is a Terminal window in NetBeans 7:
Open the menu, Window -> Output -> Terminal
What about using an Ant target? Ant files are quite comfortable to run from Netbeans.
<exec executable="${executable-full-path}" ...
The best option I've found is to use jmarsault's plugin that he calls NetBeans Command Shortcuts. This give you an icon in the command line where you can add command and terminal scripts to run. The display shows in the output window.
Installation files are available here and he has kept it up to date with the newest versions of NetBeans.
NetBeans Command Shortcut plugin
Installation:
Download the .nbm file for your version of NetBeans
Open Tools / Plugins / Downloaded / Add Plugins...
Select the .nbm file and allow the installation of the plugin.
In since at least version 9.0, there are two decent options:
Just create a script file. (I think you need the C++ plugin for this. Otherwise you have to create it outside NetBeans or as a text file.) In my case I created a JLinkGDBServer.sh that just executes JLinkGDBServer as a prerequisite to start an embedded debug session. This automatically sends the executable's output to a NetBeans terminal.
Add a tool to Tools/Options/Miscellaneous/SendTo. SendTo is a pop-up menu item for certain project entities, for example files but not the project. In my case, I could add a SendTo running the executable and use it by right-clicking on for example the .elf file (although for the GDB server I don't need any file name as an argument).

How to make the eclipse IDE to build faster

I am using Eclipse for development. However, it's is taking too much time to build.
It hangs when the percentage of build gets to 78. It shows "refreshing workspace" several times. That eats up lots of time.
How can I make Eclipse faster?
Increase the start-up memory as mentioned by thamaria
Disable spell check of eclipse
Disable the plugins which you never use it (myln etc)
Disable auto build.
This link might help you
http://pakkatechies.blogspot.com/2011/07/making-eclipse-ide-faster.html
There are many possibilities to tune Eclipse.
First, when Eclipse is hanging up you should start Eclipse with some arguments and give it more memory. Use: eclipse -vmargs -Xms256m -Xmx1024m or even more.
EDIT: "eclipse -vmargs -Xms256m -Xmx1024m" is the commandline command with which you can start Eclipse (well, depending on your OS). For that you either need to have eclipse in your environement path or you will have to use an absolute path to your eclipse executable file. Under Windows systems you may use for example "C:\Programme\eclipse\eclipse.exe -vmargs -Xms256m -Xmx1024m". You could f.e. create a short-cut with this command.
Second: If possible you can use several workspaces for your eclipse projects if they are not connected to each other. When using other projects than the ones located in your actual workspace switch the workspace to the one you desire. That way eclipse does not need to load all contents at startup and will therefor start much faster.
Third: You can disable the "build workspace" Option. Go to "project" --> and uncheck "build automatically".
In the project build properties, under behavior tag, check the 'Enable parallel build' box.