Running Eclipse projects on the Command Prompt - eclipse

I have a console-based C project in Eclipse. Is there a button I can press to launch my application in a Command Prompt window?

You can run your application as an External Tool, and there's a toolbar item for that. Looks like a green circle with a white arrow, beside a red toolbox. I'm a Java developer so I don't really know the CDT, but at least in the JDT you can run any command line tool in this way. (If it's not in your toolbar, right-click the toolbar and choose Customize Perspective… then find the External Tools item under Launch, and add it.)
First, click the down-arrow beside the button and then choose External Tools Configurations…. In the dialog, select Program from the left side and then click the New button in the toolbar. You are basically creating a shortcut that will live in the toolbar. At this point you can fill out the command line details to run your application. There's a lot of goodies like setting up environment variables, requiring a build of your projects before launching, etc. When you're done, save it, and you can run it as often as you like by clicking the arrow-and-toolbox button. You can come back and edit it later too, make duplicates, etc.
If you're working with a team, or you just want to do a really nice job:
In the Common tab, under Save as, choose Shared File. This will create a file in your project to represent the tool shortcut that you're building. That means you can check it into your source tree, and others can use it too. These files are XML so you want to check them in as text, not binary.
Start your working directory with ${workspace_loc} so that anyone who checks out your project can run it without having to adjust the shortcut for their file system.

Not directly, but you could configure an Ant task to run it (if it doesn't require console input), or you can configure firing up a JVM under Run|External Tools.

Related

How can I configure Eclipse to save console out for my build?

I specifically only want console out for Building my code, which is primarily C++. Every search for this leads me to configuring Run Configuration(s) to output the console. I'm not trying to RUN my program, just want the additional detail from console-out when I build and get warnings, some of which I'm not getting filepath info in the "Problems" window. Thanks!
This might already be set up by default. It was for me, once I found the solution I realized this. Check if the following filename exists:
<workspace_name>/.metadata/.plugins/org.eclipse.cdt.ui/global-build.log
If it's there, you might already be setup with build output saved to a file. It should be saved in this file. If you don't have this file, and/or you want to change the file location, do the following: click Window context menu->Preferences. Expand the triangle next to C/C++ on the left sidebar, then under that sub-menu, expand the triangle next to the Build menu, then click Logging. Inside the Logging window, ensure the checkbox next to Enable global build logging is checked, then click the Change... button next to the Log file location text box and select your log file. (In Linux, this part may not be so easy if you don't have a log file already touched. In this case, navigate to the directory in which you want to save your log file, then click the button in the top left that looks like a piece of paper with a pencil over it (when hovering over this button it says "Type a file name"), and then type the name of the log file you wish to use. Click Ok.) Then in the Preferences window, click Apply and/or Ok. Next time you build, this log file should be populated automatically with your Console output.

Netbeans IDE scaling too small

The Netbeans IDE menu icons(new project, open project, etc) are all extremely small. Any pop-up menus that open while I am working start with very small dimensions, forcing me to expand them so I can see what I am doing.
How do I increase these sizes?
I looked up a solution that involved editing the netbeans.conf file, but if I tried to save the edits, the computer said I needed admin permission(I am an admin in the computer).
What can I do to resolve this?
To edit netbeans.conf you text editor must be running in administrative mode. In order to put it in administrator mode follow these steps.
1.) Use the windows search bar and search for the text editor you want to use.
2.) right click on it and then click on "Run as administrator"
3.) use your text editor to open the netbeans.conf
Now you should be able to edit it.

Eclipse Shortcut for Team - Synchronize with Repository

What are the shortcuts for the context menu actions "Team -> Synchronize with Repository" and "Team -> Update" on the whole project?
I have already found shortcuts, but these are executed only on the file i have currently opened. But I want to execute it on the whole project without having to scroll the project explorer to the top and right-clicking on the project.
If there are no such shortcuts, how can I create them?
As john.k.doe indicates, that's the right solution, but you also need to do something else in order to make the shortcut actually work, which is go to Window > Customize Perspective > Command Groups Availability and there just check the SVN box ;)
you can almost always get the key shortcuts you want by
go to preferences type "keys" or go to General -> Keys
in the field presented when you click on "Keys"
in the left pane, type the command you are interested in setting up a shortcut for:
the image below is from my mac, but it works the same way on windows/linux, you just might choose something besides Cmd-Y as your shortcut modifier. the U under User indicates that i was the one to add that modification.
I have written a small Eclipse plug-in which selects the active project in the Package Explorer so you can execute other actions (like 'Sync with repo' and 'Update') on it. I think this approach is more flexible compared to writing a plug-in that selects the project and executes a predefined action.
You can get the plug-in at http://code.google.com/a/eclipselabs.org/p/eclipse-tweaks/downloads/list, it is named "com.xakcop.select". Download it and put it in the dropins/ folder of your Eclipse installation. Then when you restart Eclipse, you will find a new command Select project in Windows->Preferences->Keys. The default key binding is Ctrl+Shift+Backspace but you can change it to whatever you want.
When you are in the Java editor just press Ctrl+Shift+Backspace, this will select the project that the current file belongs to in Package Explorer. Then press the shortcut for "Synchronize with repository" and you are done.
The source code of the plug-in is also available as part of my eclipse-tweaks project: http://code.google.com/a/eclipselabs.org/p/eclipse-tweaks/source/browse/com.xakcop.select
I think the answer to this question adresses the issue.
The quickest way I've found to update/synchronize, after having set the shortcut keys, is to click on the minimize button in the Project/Package Explorer and then press the keys. After the update, simply clicking on the last used file in the editor returns to the previous workspace state (provided the "Link with Editor" button in Project Explorer is selected).
I should clarify: I use a working set for each project. The working sets are displayed as default Top Level Elements in the Package Explorer so, by clicking on the minimize button the desired Project' working set, they collapse and are easy to select. Then, I apply the shortcut on the selected working set.
From my point of view, the problem is the focus of the commands you execute.
The Team commands Snychronize and Update are executed on the current object (In my case). As you noticed, when you execute the command on the project, the project is synchonized - when you do it on a file, only the file is synchronized.
What I did as workaround is the following:
I created Key-Bindings for the commands Show in (Navigator) (Alt-N), Go to (Alt-G), and Show View (Naviator) (CTRL+SHIFT+Q, N).
With Alt-N I show the current File in the Navigator. I can then use the keys to navigate to the root that I want to synchronize (it's not always the whole project for me). If the root is to far away I use Alt-G and type the Project or Folder where I want to go to and execute afterwards the Synchronize commands.
(Go to works only in the current view)
If you have selected the Project once you just have to switch to the navigator (Show View command) and execute your synchronize commands.
You could also use rgerganov's plugin then you would not have to execute as many commands.
The procedure works also with other views (package explorer, project explorer)
What about this approach? It should also work for other SCM's or commands you want to execute on any object in the explorer views.

How to create default debug and run configuration in Eclipse?

Whenever I hit Debug or Run in Eclipse, I get a dialog asking me what configuration I want to use.
How do I set a default configuration and bind a keyboard shortcut?
Maybe this article from Eclipse One Tips will help you:
How to run the last launched application
The answer lies in a preference hidden on the Run/Debug page:
Go to Window > Preferences > Run/Debug > Launching.
Select the option Always launch the previously launched application. It’s located at the bottom of the dialog.
The preference should look something like this:
Now you’re free to press
F11, Ctrl+F11 or click the Run/Debug
icons on the toolbar with confidence, knowing it’s going to run what
you expect it to run.
One question arises: How do you quickly run a class as a specific
application (eg. a JUnit test) if you can’t press F11 to
run it? You have some options available:
The fastest way is to use keyboard shortcuts. Eclipse allows you to launch classes using a keystroke, including JUnit tests, Java
applications, etc using Alt+Shift+X.
Alternatively, right-click on the class and select Run As. The submenu will show available options for launching the class.
Lastly, you could click the pulldown arrow on the run/debug icons in the toolbar and select Run As. The submenu once again shows
available options for launching the class.
Eclipse plug-ins that add new project types may contribute 'Launch Configurations' to control how Eclipse executes the application. For example, J2EE based projects need to publish content and start the application server. Contrast this with simply starting a JVM for a regular Java application.
When you select a configuration, Eclipse records this for future use. You can access these by selecting the 'Run/Run Configurations' menu item or selecting 'Run Configurations' from the little drop down menu next to the run and debug toolbar buttons. You can also add new launch configurations through the Run/Debug Configurations dialog that opens. In this dialog, you should see one or more configurations that you previously launched. Selecting one reveals all the info Eclipse uses to launch your application. One tab called 'Common' contains options for controlling the your favorites menu. Checking the box next to Run or Debug will add this launch configuration to the top of its corresponding menu.
If you only have a single configuration in your menu then Eclipse will launch it when you click the associated button. If you have more than one then Eclipse launches (sometimes) the most recently used. I say sometimes because, occasionally, one launch configuration causes another to launch, which cause the last used configuration to be the second one when you would expect it to be the first one. Usually this happens to me when I launch an application, which needs to be built and the build launches a tool. When this happens, just select the correct launch configuration from the drop down menu.
You can bind a keystroke combination to the Run and Debug commands through the 'Windows/Preferences' menu item. Then select 'General/Keys' in the tree control on the left.

Customize eclipse taskbar

I use a lot of eclipse shortcuts, but for some tasks there arnt any convenient ones. For example I frequently look at the subversion history for java files.
I see these icons next to the right-click menu items that I assume I should be able to place on the eclipse taskbar so that I can save a couple of mouse clicks. But I havnt been able to figure out how to do that yet.
I am talking about the icon next to RightClick-Team-Show History once you install the subclipse plugin. I would like this icon to be on my taskbar so I can just do a single click and look at the history.
Any suggestions?
Other tips on customizing eclipse for java development are also welcome.
Take a look at my answer for similar question: How to add undo / redo buttons to toolbar in Eclipse?
It is possible to do the same for Show History command. Differences are: 1) you need to declare dependency on org.tigris.subversion.subclipse.ui plugin, and command ID you are looking for is org.tigris.subversion.subclipse.ui.showresourceinhistoryaction. You may want to include custom icon to avoid having long "Show History" button on your toolbar.
Update: Here is downloadable plugin for you: showsvnhistory_1.0.0.jar
The only way I know of to "customize" the Eclipse taskbar is via Window -> Customize Perspective. Oddly enough, the "Commands" tab has some influence on the toolbar.
But the developer of whatever component you want to use must have enabled the commmand and (at least for me), SVN doesn't offer a history button.
Maybe some XML hacking is more helpful here?