How to run a batch script (.bat file) from eclipse - eclipse

My Java application is started by running a set of commands that are present in a batch file (.bat file). And I imported this into Eclipse workbench. How do I execute the batch file from Eclipse. Similar to the one in command line, I directly give "path:\myBatchfile.bat". Is there any way I can do directly from Eclipse.

You can call your .bat file using the External Tools feature (in the Run menu).
Example:

Or, you could create an Ant build file, which can call external applications.
This will give you the advantage to call the .bat not only from Eclipse, but other IDE's, or from command line (on any machine).
http://ant.apache.org/manual/Tasks/exec.html

You can also run a batch file (or any other executable file) by opening it with the System Editor. Use Open With -> System Editor.

Associate with text Editor by right-click - Open With
(As of 2017 there is no plugin with special editor )
To run install plugin like https://marketplace.eclipse.org/content/easyshell
You can easy run .sh with Git Bash as well
or https://github.com/culmat/eExplorer

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

Eclipse --launcher.openFile does not open the file

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

Find the command and options used by NetBeans IDE

I am using a the NetBeans 7.x IDE. I have a Netbeans Application module. I use the Build and the Run buttons from the IDE. The module runs just fine when I press Run Project or F6 button. I like to run
this from the command line. Since everything was build automatically for
me I have no idea where things are or how to run it. There are several jar files in the project/build/public-package-jars. Is there a way to see what command and options the Run Project is using ?
Go to the root of the application (or wherever there is a build.xml file) on the command line and run ant -p. That will list all of the available options for building and running the application.

Launch and debug a single script in PyDev

I am a beginner in using Eclipse and PyDev (Aptana Studio 3). I am not used to and i don't understand the workflow in such big IDEs as Eclipse.
I have a simple task: i have a simple Python script, which i want to open and run in Eclipse, having its output in Eclipse console. Or debug it.
Until now i used another IDE called Eric4, which allowed me to do what i want - open a file and run immediately, without creating a project or setting up launch configurations.
Is this possible in Eclipse, or i have to create a project for each file i want to run or debug? I want to understand how it works.
I guess i understand that creating a project is needed at least for settings up the paths (PYTHONPATH), but if it's a single script - somehow to use by default the current directory?
For example i have a folder called snippets where i keep a lot of python scripts which demonstrate some functionality. How do i open these files one by one and run them?
Most of my coworkers launch python scripts in a separate console - python my_scipt.py.
You need to have at least one project with the configuration you want (i.e.: syntax type, interpreter), then, open the file you want to run and press F9.
If it's an external file -- i.e.: a file that's not under a project in Eclipse -- it'll ask you to associate a project with the launch to get the needed information for the launch, but the file doesn't really have to be in the project (note that you can drag external files from your filesystem into Eclipse to open them).
I suggest you follow the steps on the getting started: http://pydev.org/manual_101_root.html (it guides you to configuring PyDev and explains how to do a run/debug session).

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