Project name not appearing in debugging Eclipse - java

I have cloned a Bitbucket project in my Eclipse IDE and I want to debug the project as a remote application.
However, in the debug window (->connect window), the project name is not shown.
Why do I not see it?

I am Attaching Screenshots where you create Debug Configurations for any Remote Java application.
Lets Go step by step:
Within Debug Configuration Window
You right click Remote Java Application > New
In the Connect Tab you browse the project in your Workspace (One you want to debug), Here in my case it is MyApplication
In Source tab You Find below details where you add any dependent projects with the project that you want to debug
When you say Add here, small dialog box comes up and here you can again choose Java Project, that would be one from your workspace.
I think doing this you would find your Project for Remote Debugging.
Hope this helps..!

I didn't see your problems related screenshots, but according to the situation you described, you can try the following method:
On the debugging of threads Right click it
--select Edit Source Lookup Path
--Select Add
--Select the Java Project
--choose the Java Project you worked with then click OK.
The other situation I think about is whether or not you don't have the jar that you're relying on for the project you downloaded

I had same problem. I had imported project as import project from file system. so it was not java or maven project for eclipse i guess.
i just did import as git project and tried again and it worked.

Related

Run a Maven Project using IntelliJ IDEA

I'm new to IntelliJ IDEA and I would like to run a simple Maven Quickstart project using it.
I followed all the instructions, the project was sucessfully built. But when I try to compile and run it , the Run button is not activated.
It looks like IntelliJ IDEA couldn't figure out where the main class is.
This is a picture of the project's hierarchy.
What is the problem ? And how can I fix it ?
Thanks !
Refresh the Maven project in the Maven Projects tool window (Reimport All Maven Projects), if it doesn't help, refer to this answer for diagnostics.
The issue is that your source roots were not configured correctly from the Maven model for some reason and the .java file appears in a plain directory instead of the Source root.
You can tell that by the color of the folders and by the icon of the file.
You need to create a Java Project.
File->New->Project->Java->Next->Next->Finish
Then go to the top and do:
Right click parent folder of project->Add Framework Support->Click Maven->Ok
Now Maven should be added to your project and also you should be able to run it
If this doesn't allow you to run the project, click the little drop down box to the left of the grayed out run button and click Edit Configurations.
Then click the + and click Application and set your Main class to the class that has the main method in it, and then it should allow you to run the application.
Hope that helps!
Seems like your java directory is not marked as Source root. Right click on it and click Mark directory as -> Source root
Have you imported the project as a maven projet ?
If yes, click on the body of your fonction and then do CTRL+MAJ+F10 or MAJ+F10
My issue was that I was looking for the equivalent of calling "mvnw" from the console/terminal.
.mnvw (linux) OR mvnw (windows)
I didn't know where this was in IntelliJ. That's how I interpret part of the question that was asked.
The solution wasn't obvious to me so I wanted to share it.
Conceptually, you want to run the default maven configuration (not a specific lifecycle stage). Therefore you need to select the root entry in the Maven panel:
Then you can play the green play button on the panel:
Alternatively, you can right click and run the maven build from the context menu.
If maven not visible top-right side then maven plugins not avaiable in your intellij IDE.
Follow below steps:
click settings icon(top-right side)->select plugin->click on checkbox at maven option->click apply button then ok button.
After few minutes maven able to see in you IDE.
You need to add to project e.g. Jetty or Tomcat (compile to WAR & run Tomcat server with this war).
If you will have Jetty maven plugin you will be able to run app via mvn jetty:run (Add this to Maven run configuration)

How to install a Plug-in project to my Eclipse? (Version: Luna Service Release 2 (4.4.2))

I have generated a demo popup menu plugin project automatically by Eclipse. Here is the project structure,
I have set a objectContribution to the point org.eclipse.ui.popupMenus,
When I right click the project and choose Run as -> Eclipse Application, another Eclipse process run and I can see the configured menu works well,
How can I install this plugin for my original Eclipse process?
What I have tried
I did some research and tried to Export -> Deployable plug-ins and fragments, then put it into the %EclipseFolder%/plugins, but it didn't work. I also have tried to Export -> Deployable features and installed it by Help->Install New Software, also failed to see the menu when right click the project.
Will you please help? BTW, I would like to know how to contribute a menu which will display when I right click on a package in a project? Thanks so much.
Use the Deployable plug-ins and fragments wizard and select Intall into Host on the Destination page.
This will create a p2 repository at the denoted location and install the selected plug-ins from there into the host instance, i.e. the Eclipse IDE that you are currently working with. I think a restart may be required.

Using Git with Eclipse causing lots of errors

I made a HelloWorld app in Eclipse that had no errors and runs fine. It was located in
Android/workspace/HelloWorld
Then I created a Git repo elsewhere in, say
Git/MyApp
I want to have MyApp contain the HelloWorld project from eclipse, and when I make edits to HelloWorld, it will show up in git status and I can commit and push those changes.
I tried copying the HelloWorld directory from the workspace into MyApp, then pushing my changes to my repo, which was fine.
Then I deleted the original HelloWorld in the workspace, went to Eclipse, hit import existing project, and selected the HelloWorld from the MyApp repo. But this resulted in a ton of compilation errors. How can I do what I'm trying to do without all these errors?
I've attached a link to a screenshot of the errors I get upon compilation.
I have Understood your problem,your project have a relationship with appcompact.Whenever you import your project you have to check below scenario,
Right click your project ---->select properties--->In side bar select "Android" Tab--->now you can see Project build target and Library Box--->in Library box click add and choose appcompact project and then click apply.
After done above one clean and build your project.Then it will work fine.
try Clean operation on your project and then build your project. replay whether it solves the issue or not.
As a matter of fact it looks to me like your eclipse doesnt recognize your app-compat anymore.
This happend to me once too, after I closed and reopend the appcompat-project.
Try to close all your projects -> open the appcompat first -> restart eclipse and maybe do a clean on your project
Hope this helps.

Eclipse Debug: Source Not Found while remote debugging

In my Java eclipse project, while I am remote debugging, eclipse does not step into the class files of imported library files even though the source file jars are properly mapped to the library files.
Instead it gives me a "Source Not Found" error. But when I am editing the same class in eclipse, I can control-click a class or method name and it takes me to the correct library class file.
Can anyone please tell me what I am doing wrong?
I am using Tomcat 6 and latest Eclipse Java EE.
In this scenario just follow the following steps:
Go to Run → Debug Configurations
Select the remote application configuration being debugged.
Select the second tab named 'Source'
Now add the folder/projects containing the source code explicitly here.
In the Java build path for the project, under the sources tab, check if your class path is under the included list. If its under the excluded list, remove it from there.
As Saury said, get your debug configuration right. When remote debugging, often developers have selected the wrong project while creating a new configuration. Verify you select the project you wish to debug and it corresponds to the version of the deployed WAR/EAR/JAR in the appliation container.
I faced same issue and got solved by below steps in eclipse.
Go to Severs tab in your Eclipse tab
Right click on the server and click on Add and Remove Projects
Select/add the project EAR which you want to debug
After finish - Start your server in debug mode
Should solve with above steps as it resolved for me:)
I ran into a similar problem. It turns out I was missing the devel package on CentOS.
In my particular case, the following yum statement solved the problem.
yum install java-1.7.0-openjdk-devel
Follow the next steps in case you use a parent project connected to sub-project/s:
Use the 'Debug Cofigurations' source tab or the 'Edit Source LookUp path' option to attach the sources of the running code.
Note: you'll need to attach the src folder of your inner project rather than the target in order to make it work (check the screenshot below).
E.g.
An update for eclipse Oxygen (Feb 2018):
Attaching the Java projects (sub projects) also worked well; e.g:
Check under "Debug Configurations" -> "Remote Java Application" -> Tab "Connect" -> "Project" that you chose the correct project.
Here is how it worked for me. Did this on Eclipse oxygen
Go to debug configurations and then the source tab
Click on Add
Select Java Library. Hit ok
The select Web app libraries and click next
In the next screen select the project/application that you are
debugging.
Click Finish
This worked for me like a charm
Using Eclipse version Oxygen.2 (2017), the accepted answer did not work for me. The following procedure was successful.
Launch the application to debug with the Xdebug and Xrunjdwp switches.
cd "C:\Program Files\Test_742\Test 7.4"
test_app.exe -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8500
Create a new workspace in Eclipse.
Create a new Java project using File -> New -> Java Project.
Copy the source code of the Jar to debug to the src folder of the new project. I found it necessary to ensure that I copied the complete folder hierarchy of the source code to my source folder.
For me that meant copying \com\test... to my src folder.
This puts all the source code in the build path.
Copy any dependency JARs to the project. I created a new folder named myJARs.
Refresh Package Explorer to see the new myJARs folder.
Add the dependency JARs to the build path by opening File -> Properties -> Java Build Path -> Libraries (tab), and click Add JARs...
Add each dependency JAR to the list, then click Apply and Close. This adds the JARs to Referenced Libraries.
Configure a debug session. Click Run -> Debug Configurations -> Remote Java Application. I set Connection Type = Standard.
Configure Host to point to the machine running the JAR and Port to the port specified in the address portion of the command line switches (8500 in my example).
Notice that on the Source tab, both the source files and the dependency JARs are present.
Click Apply, then Debug.
View the debugging perspective by clicking Window -> Perspective -> Open Perspective -> Debug.
Place breakpoints in the source code.

I get "Source not found" when debugging my Java code in Eclipse

I'm trying to debug my Java application in Eclipse however when I hit a breakpoint I simply see the following instead of my source:
If I change the stack frame in the Debug window then I can see the function name change in the tab - this is definitely my code, the line number is correct and I'm using the latest build but I still can't get Eclipse to show the source (despite it being open in another tab!)
I'm new to Eclipse and so I'm struggling to find my way around, but everything that I've stumbled across so far seems fine to me.
What might cause this to happen and how can I fix it?
Sounds like the 'source lookup path' section if you edit the debug configuration isn't setup correctly?
Click on "Edit Source Lookup Path" button and then click on Add button then Java Project and include your imported project .. Hope this will solve your problem
I also had this issue in MyEclipse Blue. I resolved it by following these steps:
Debug the project.
Right click on the Thread (Which you will see in Debug tab) and click on the "Edit Source lookup"
New window will open and hit the "Add" button and Select the "Java Project".
Get all the project that is listed over there.
Restart your server.
I had similar problem with my eclipse maven project. I fought with this issue quite a long time then I tried to rebuild projet with
mvn clean eclipse:eclipse
and it helped.
When I faced this problem for the very first time, I've already done all the steps mentioned here. Curiously, my problem happened when I've copied a project into another place. Anyway, the debug starts to work without warnings, after simply remove all breakpoints that was originated from the original project.
Sorry about my English , I'm not fluent.
We had the same problem and none of the suggestions above worked. What did work, was deleting the local workspace and from Eclipse checking out from the repository again. The problem occured for everybody previously working with Netbeans and making the switch to Eclipse.
Try this:
Select Project
Right click
debug
Debug configuration
Select Source Tab
Click on add button
Select Java Project
Add your project there with check box
For local projects I've solved it by selecting the "Resolve Workspace artifacts" checkbox in the Debug Configurations.
This is a common error while debug in eclipse. You can fix it through edit source look up. But make sure once you attach the Project You need to stop the server and again start in Debug mode. It will work.
Here is the detail steps :
Click on "Edit Source Lookup Path" button .
Then click on Add button.
Select Java Project and include your imported project
Then stop the server and start it in Debug mode and hit your service. It will work.
After trying most of the solutions here, try this too once -
Close all the .java files from the editor, in fact, close all unrelated projects in eclipse.
And try running the Debugger.
I solved this problem by adding the class file into the src folder within the project. Hope this method may help.
I got this error when I was running my server using a maven tomcat plugin. When I deployed using my configured server in Eclipse (generating a war file and copying it into my tomcat directory), I didn't have this issue anymore.
In your debug configuration add goals as "clean install"in the maven build con
This is an expansion on JAB's answer:
Click "Edit Source Lookup..." > Add... > Workspace Folder > Project > select your folder > check Search subfolders box > OK.
In Eclipse:Window-->Go to preferences-->Java-->Click on JRE-->Edit--->Restore Default and click on Finish.
Update your Project before Debugging the code!
Alas! It worked for me.
This occurred to me when my working git branch is updated from code in master branch. I have already run mvn clean install after the pull, but seems I had to update projects after the maven build so that project source code and JAR build code gets synchronized.
Right click on your project -> Maven -> Update Project, then select all the
maven modules available and press OK. This resolved the issue for me.
I was facing same issue. After banging my head for several hours, I finally noticed that although Maven was building the project successfully, the source file I was trying to step into had an incorrect package statement and that is why the 'Source Not Found' eclipse problem was happening. When I corrected the package statement and rebuilt the project, the debugger found source file and stopped on my breakpoint.

Categories

Resources