Eclipse --launcher.openFile does not open the file - eclipse

I have been trying to open a file from the command line in a running Eclipse session. Based on the documentation, I should be able to do
eclipse --launcher.openFile myfilename
However, when I do this, there is a long pause, and then Eclipse tries to launch a new session. It gives me an error message that the workspace is not available, and then wants me to choose a new workspace.
How do I open a file in the currently running Eclipse session, from the commandline?

As of Eclipse Helios (3.6) you don't need special command-line parameters to open files from the OS file explorer or command line (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=4922). I think you should be able to just do eclipse myfile.java (as long as you have associated .java files with Eclipse).

Related

Is there a way to open launch eclipse from command line, like vscode?

I am wondering if there is a command similar to code ., but for eclipse.
I'm using a Windows 10 computer.
Yes, the command line lets you open files using the --launcher.openFile parameter, and I think it prompts you with the "open projects from file system" wizard when you give it a directory. I'm not sure it works as smoothly since Eclipse lets you use the same binary for more than one workspace.
https://wiki.eclipse.org/Eclipse/OpenFileFeature

How do I make eclipse.ini stop changing when I restart eclipse?

I recently installed eclipse Luna for Windows 64-bit. I have the ini file customized. Specifically, I have to set the VM path because the reference to Java on the path is for a different JVM that does not work for eclipse.
Every time I close and reopen eclipse, the vm entry in the ini file is removed, so I have to set it all over again and open eclipse. Is there a setting in Luna to change this?
Eclipse itself doesn't do this; there are plugins which sometimes rewrite the ini file to "fix problems" (usually giving Eclipse more memory) and I've seen cases where Eclipse was started with a script that replaced the ini file with a "known good" copy.
In either case, you will have to examine your installation. Use the "About" dialog to find out which plugins are installed and then find out what they are and what they do. One of them is the culprit.
One way to work around the problem is to create a copy of the file as eclipse.config and use a CMD script to start Eclipse. The CMD script should copy eclipse.config to eclipse.ini and then start Eclipse. That way, anyone can change the INI file but it won't matter.

eclipse command line switch to start with project

What is the command line option to start eclipse with a specific project?
I can get the correct workspace using -data.
Within that workspace, I want to have a specific project loaded, similar to the "Go Into" command.
I don't think there is such an option right now.
Oening a file from the command line has only taken 9 years: bug 4922:
If your Eclipse Helios 3.6 eclipse.ini file contains "--launcher.defaultAction", you can open any file with:
eclipse.exe myFile
But open directly a project is still missing.
See this SO question which contains an Eclipse plugin that only loads specific projects (which are defined in a config file) into the workspace.

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).

Using Eclipse as an Editor (like Coda or Vim)

There is a Python project created by using Vim and Coda which doesn't include any editor specific file. I'm used to use Eclipse as an editor so I want to work on this project using Eclipse. But I don't know how to do it without to create a new project in Eclipse or without importing it. Because I don't want to get a copy of these files. I just want to edit like I can do in Coda or Vim.
From Eclipse do File->Open and it will load the file even if not in a project
From the command line on my machine the expected open -a Eclipse.app t.py does not work as Eclipse has not registered itself as being able to associate Python script files (it also fails to open java files so is Eclipse not pydev setup)