Debug in Eclipse while running from command line ubuntu - eclipse

Is there a way I can debug my application (using breakpoints in eclipse) while running it from command line (ubuntu)? I'm using Eclipse Kepler version on Ubuntu 12.04LTS.
I know there's something like attach to process in .net, was wondering if eclipse has some such setup.
Thanks,

Is your application written in C or in Java?
If your application is in C and you are using CDT, you can attach to existing project by:
Run your application from terminal.
In Eclipse CDT, go to main menu "Run"->"Debug Configurations...", double-click "C/C++ Attach to Application" and press "Debug" (you should not need to specify executable and/or project).
For Java applications, see this

Related

How to run eclipse luna mac os with java 7

i need to execute a ant script inside eclipse luna using java 7.
The problem is that if i try to change the path with jenv or try to set JAVA_HOME inside eclipse the ant script inside eclipse is always executed with java 6.
The OS is macOS Sierra.
I have to use eclipse.ini ?
Thanks
Assuming you are running the Ant script the normal way you can configure this in the configuration for the script.
Open the External Tools Configuration dialog using 'Run > External Tools > External Tools Configuration...'.
Find your script in the 'Ant Build' section and then look at the 'JRE' tab where you can set the JRE/JDK to anything you have told Eclipse about.

Using intellij to debug eclipse plugins

I am currently working on eclipse plug-in that involves many modules, and I would like to debug and run this eclipse plug-in from IntelliJ.I open this project in IntelliJ to edit code but when I have to run/debug this project I have to open eclipse IDE and start it from there. How can I use IntelliJ to do this?
I haven't actually tried this ... but you could try launching the RCP application stand alone but with the remote debug parameters specified for in your application's .ini file.
Then just point IntelliJ to the appropriate source and attach it's debugger to the running app.
Why do you want to do that? Eclipse has multiple tools for the plugin development that you will miss in IntelliJ. Also you need to build your plugin as product headless and then attach a debugger to it.
In my opinion it doesn't worth the effort. I would install Eclipse and devolop with eclipse.

How to configure Eclipse CDT with GDB debugger

I went through few queries on Eclipse CDT and GDB but I am getting more confused. I am a newbee to both GDB and eclipse.
My problem is as follows:
I have got test.exe file generated by Cygwin with a set of make files etc.
I can perform debugging using the command gdb ./Test.exe from the directory. This debugging is very sparse.
I learned that eclipse can interface with Gdb debugger and give nice GUI and debugging facility.
I will be grateful if someone can show how to load this test.exe in eclipse and run the code.
Thanks
Switch to c++ perspective in Eclipse.
Select Run -> Debug configurations in menu. Select C/C++ application and click on "new launch configuration" icon. Click on browse button to locate your executable, apply configuration and click the "Debug" button.
This should launch your application and locate sources, provided you compiled with -g3 (or similar). Make sure you also used -O0. (BTW: I tried this with mingw, not cygwin).
You could import Makefile project into Eclipse/CDT and use Eclipse for development.

Debugging Eclipse plug-ins

This is my first attempt at creating an Eclipse plug-in. I've created one, along with a feature and update site. I set the target platform as my local Eclipse installation. When I run/debug the plugin from within the development environment everything works fine.
Now, my colleague installed the plug-in from the update site that I hosted. When he starts using any of the functionality exposed by my plugin he gets runtime exceptions.
He sees null pointer exceptions which didn't occur when I ran my plug-in project from my development environment.
I have a wizard that's part of my plug-in. When he close it he gets a "Unhandled event loop exception", and the wizard doesn't close. I didn't have this issue when I was running/debugging my plugin in my development environment.
Now I'm confused as to why the same plug-in is behaving differently in the production environment, as against the dev environment and when I was debugging it from my IDE. The target platform in both cases is the same Eclipse version. What could be the reasons?
And how do I debug the plug-in in a production environment? Is there a remote debugging capability for debugging the plug-ins on the production environment?
Any suggestions would be really useful!
To remote debug your plug-in, first add debug arguments to your target Eclipse .ini file
-vmargs
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044
before launching it.
Then open another Eclipse instance with a workspace containing your plug-in project.
Open Run > Debug Configurations..., select Remote Java Application and create a new configuration.
As Project, browse and select your plug-in project.
Also fill in your connection properties (host of target Eclipse and port 1044).
Launching the newly created debug configuration allows you to debug your plug-in the same way you debug locally.
Now I'm confused as to why the same plug-in is behaving differently in
the production environment, as against the dev environment and when I
was debugging it from my IDE. The target platform in both cases is the
same eclipse version. What could be the reasons?
This is a classic: Eclipse plugins and RCP applications do indeed behave differently between PDT (the Eclipse IDE) and the exported product.
In your case, a NullPointerException thrown from the exported version but not from Eclipse is 9 times out of 10 an image or other resource files (properties, etc.) that is loaded by your code but is not listed in the build.properties of your plugin.
Anyway, you'll need to check the logs to retrieve the stacktrace and hunt down its cause. Such logs could be found in your friend's workspace under le .metadata/.log file
From your development workspace as it stands now, use the "Debug As -> Eclipse Application" menu item to startup a test workspace. When it starts up, you'll have two workspaces running: the original development workspace and the new test workspace. You can set breakpoints in your plugin code in the development workspace and run your plugin in the test workspace.
When your plugin execution in the test workspace gets to one of your breakpoints, execution will pause and you can use the Debug view in your development workspace to look at variables, set more breakpoints or anything else you want to do to debuf your plugin.
See the Apache Wiki for Developing with Eclipse.
Under Windows 10 with Tomcat running as a windows service I started:
tomcat8.5\bin\Tomcat8w.exe
& added in the Java tab as the first entry in Java Options to enable remote debugging:
-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n

How do I run an eclipse project without eclipse?

I want to send my project I made in eclipse to others, so I tried running the project in my workspace. But I don't have a software to run it.(besides eclipse) What software should I use?
I don't have a software to run it.(besides eclipse) What software should I use?
You should use Java. Eclipse is just an IDE, so it doesn't run your Java programs. Java does. Export your program as a JAR, and if you have Java installed, you can run the JAR by double-clicking on it, or by running it from the command line:
java -jar file.jar
First Step
Second Step
Third step
voilĂ !