I know this is a frequently asked question, but i have been searching for a solution for my problem online since yesterday and have not been able to find any!
I am using Eclipse Helios with Tomcat 6.0.2, when ever I try to debug my code using the tomcat and eclipse i am getting the error Source not found, this is the case for even the code that i have wrote myself and not just all the jar files
I have the java build path set up correctly, I am also using jdk1.6.0 and have this set up correctly as well so that is not the problem, it does show the code when i am debugging if i right click on the debug console and go to Edit Source Lookup.... Because this will show the source code just for that run of the debugger, I when into Run -> Debug Configurations and in the Java Application window i set it up to work with Tomcat and in the source tab I added my project and all the jar files but this does not work either! when i debug again and go into the Edit Source Lookup... it does not show me the project and jar files that I have saved in there
Does anybody have any ideas what might be happening?
Its actually very easy.Click on "Edit Source Look Path". You ll get the next popup where you need to click "Add"--> This gives another popup where you could click on "Java Project"---> THis leads to another popup where you can select your project which you are debugging and this is done! Hope this works fine.
I have solved my problem, well in a roundabout way. In my catalina.bat file I have added the line
set JAVA_OPTS= -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=n %JAVA_OPTS%
below where the JAVA_OPTS are set, this will listen on socket 5001 for any debug requests. Then in eclipse, under Debug Configurations... i created a new Remote Java Application and set the port to 5001 so that Tomcat would pick this up. Now when i start tomcat using startup.bat, when the code hits a breakpoint it opens in eclipse and I can debug like normal
Hope this helps others that have this problem
Can you debug code in other projects?
if you don't know, create a new dummy project and try to debug it
if you still get source not found for all projects, then download a fresh copy of eclipse, link it to a fresh copy of tomcat and add your dummy project to see if this work.
Hope this helps
Related
I'm building a simple calculator app from a tutorial/class on Pluralsight (Java Fundamentals class), which starts with a Main.java file, and adds a class file later, MathEquation.java.
I created a Git repo to track my progress, and uploaded to Github: JavaFundamentalsClass. I used GitIgnore.IO to find a Java IntelliJ .gitignore file, and everything seemed to be working fine on the original PC I was using.
However, after switching over to a different PC, with a fresh install of IDEA, I cloned down the repo from Github, and found that the project would not build and/or run. I get this error:
"C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.191-1\bin\java.exe" -Dfile.encoding=windows-1252 -jar ""
Error: Unable to access jarfile
Process finished with exit code 1
I suspect that there is something in the .gitigore file that is keeping some of the project, dependency, or build information from being saved in the repo that keeps IDEA from having all the info it needs to build and run the Main.java correctly.
Can anyone help? You should be able to download the project from the repo linked above in it's currently broken state, including the .gitignore file.
Additional Info
I wiped my repo clean and recloned and I forgot, originally it doesn't even give me the run button (it is grayed out). I had to do a procedure with "Add Configuration" from a search I did for that to show up to get the error above.
Also, I did install java from the OpenJDK, rather than oracle. I figured with Oracle cutting off commercial development maybe start the switch now as I'm learning, but maybe that's the issue (normal Java on my other PC).
It's working, but...
First thing - Intellij needs to know where Java is. It appears that if the SDK/JDK is not installed prior to Intellij, you will need to tell it where Java is after installing. Or if you use OpenJDK instead of Oracle Java SDK. You can do that at View/Open Library Settings, under Platform Settings / SDKs (select the JDK home path).
Then, after setting up Java, I am able to get everything working in Intellij IDEA if I find the Main.java file, right-click, and choose "Run main.main()". This runs the program okay, and also creates a Main configuration in the Run/Debug configuration area, and finally the "Run" button becomes available.
So I can get it working, but if I wipe all the files and clone it fresh from the remote repo, I have to go through running the Main.java file directly again to recreate the configuration.
So, this still doesn't answer my original question. Why doesn't this configuration get saved in the repo? What file is this information saved in? Is there something in the .gitignore file that is keeping this information from being saved to the repo?
Look like you have a different java version on your second machine.
First of all, check your java version
Update the configuration of your project, right now it pointing to java 1.8
https://github.com/LightCC/JavaFundamentalsClass/blob/master/.idea/misc.xml
I think it might be because of java not installed on the other PC you were trying. If it is installed just check whether the path mentioned has java executable file.
The first part is ensuring Java is setup, and that Intellij IDEA knows where Java is, per the other answers, comments, and addendums to the question.
The second part is setting up the run/debug configuration, per the "It's working but.." section of the question. This can be created automatically by right-clicking the file that has the main class to be run (usually Main()...), and selecting the "Run Main.main()" option (replacing Main and main() with the file and function which needs to be run)
The final piece is that to get the run/debug configurations to save to the repo, you either need to:
Share the workspace.xml file (i.e. make sure this is not in the .gitignore file). However, there is a lot of user-specific stuff in that file, so it should normally be excluded from the repo.
Or, edit the configuration and checkmark the "Share" box in the upper right-hand corner (just right of the "Name" field). This will put the configuration into a separate folder inside the .idea folder, which should not be excluded from the repo by .gitignore.
I am working on one simulator with netbeans IDE. I downloaded one simulator from their official website and it's install an running correctly in cmd.
I import existing project of one simulator into netbeans IDE and included all three libraries, so it have no error. But when i click on run icon, it gives me the following error.
So, as you see on the console tab(text with red marker), that's the error in which i need help. Thanks in advance...
Reason is you working directory in not correctly set in Eclipse for this project.
I was having same problem so I changed it.
Here is screenshot of my working directory. This Might help someone.
During the configuration of One with eclipse make sure that your run configuration path must be in synchronization with the arguments otherwise it will throws an error like you posted.
Steps:
Go to Run -> Run Configurations
After setting the proper configuration of one eclipse, Click on DTNSim present in core
Open Run Configuration Window
Click on Java Application-> Open Drag bar-> Click on DTNSim
Go To Arguments
Check Default and Others path:
It must be like the picture attached here!
One Simulator Working Window
Can anyone help me with this error:
java was started but returned exit code = -805306369
C:\Windows\System32\javaw.exe
-jar C:\Program Files\Java\eclipse-jee-helios-SR2-win32-x86_64\eclipse\plugins\org.eclipse.equinox.launcher_1.11.1.R36x_v20101122_1400.jar
Just had this issue, for me it was a corrupted workspace osgi cache. The solution was to run eclipse with the -clean parameter as
eclipse.exe -clean
After some time, eclipse required to clean up, the workspace selection dialog popped up and I could start eclipse normally again.
The -clean parameter is documented in the eclipse help
My problem was a corrupted workspace the solution was from Rob's link:
http://spacetech.dk/eclipse-failed-java-was-started-but-returned-exit-code-805306369.html
I started getting the same error "exit code = -805306369" just out of no where.
Eventually I looked at the Eclipse logs at the <workspace_directory>/.metadata/.log and realized that my Source Control plugin (Perforce in my case) was unable to connect and the eclipse was stuck.
This was because my eclipse was piggy back(depending) on the client connection that I have with my Perforce windows client and my Perforce client was not connected to the server. I connected my Perforce client and the eclipse started working normal.
this happens when mostly workspace is corrupted..... cooler solution is just to switch the workspace to safer location(new location).... and just import the project from previous workspace... princess can still be saved....
For me , Just change your Workspace to another one
I got this error, when workspace already setted up. Since the java virtual machine cannot be created. try command: java -version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I restarted my machine, and it solved my problem.
One of the class file in my project was corrupted. The name of a class file was too long and I was not able to delete or rename it, so I rename the folder containing it and then I was able to delete the project and that solved my problem.
Now i know that my workspace was corrupted, it solved my problem.
Go to your workspace and rename it.
Start your eclipse and by default it will create a workspace.
Go to File -> Switch Workspace, choose your original workspace.
I wasn't able to disable "Automatically find new updates and notify me." The option was not there on the Install/Updates page. Perhaps eclipse workbench has changed since that answer was written.
However, running eclipse with the -clean option in my old workspace did the trick for me. The way to do that in windows is to first find the directory where eclipse.exe lives. You can go to the start menu and in the "search menus and files" bar, type eclipse. You should see the purple globe icon pop up under "Programs." Hover your mouse over it and it will tell you the directory it exists in.
Then... open "computer" or some other window from the start menu and from there navigate to the window where eclipse is. Click your mouse in the bar at the top where the directory is displayed (somewhere not on the text). That directory will highlight. Now type cmd. A black command window will open and you will be in the directory where eclipse is. At the command prompt (drum roll) type eclipse.exe -clean
eclipse will start. Make sure it is asking to go to your corrupted workspace and click OK.
Wait for it and soon you will know if your workspace has been uncorrupted. Yay!
“java was started but returned exit code = -805306369” caused by Eclipse´s currupted workspace, I solved my problem with this 4 steps:
1) claose the eclipse.
2) Kill the adb from task manager.
3) Start your eclipse and by default it will create a workspace or start with new workspace.
4) Go to File -> Switch Workspace, choose your original workspace.
In my case, it is a work laptop, so pretty secure SOE
64 bit Win 7.
Unzipped Eclipse MARS onto a folder on "C" drive
Install failed consistently with Java error code -805306369
Created a separate folder on 'C' drive for workspace, granted
everyone full-control and that fixed it!!
I got same issue when opening files using shortcut - Ctrl+Shift+R.
I got it resolved by disabling "Automatic Updates".
Steps to disable automatic update in eclipse (helios): Windows >> Preference >> Install/Update >> Automatic Updates. Disable "Automatically find new updates and notify me".
How I managed to get mine working. I used a combination of the solutions above. It works for me.
Step 1: Change your workspace to some other names e.g. change it from workspace to workspace1.
Step 2: Access your eclipse and stop automatic updates (provided that you could access after changing your workspace)
Step 3: Exit your eclipse with workspace1
Step 4: Start your eclipse with former workspace by entering eclipse.exe -clean (if you are using others then use e.g. MuleStudio.exe -clean)
In conclusion, using a combination of solutions such as changing workspace, stop automatic updates and -clean work for me. Try it yourself.
My issue isn't a new one, and I found several threads about it, yet no one was helpful for me.
I hope this one will.
I can't debug with eclipse. It recognizes breakpoints, switches to debug view, but somehow it gets out of sync and I can't debug my code. Sometimes It works, but after a while It happens again.
I work with JDK 1.6.0_24, Glassfish 3.1, eclipse INDIGO (but it also happens on HELIOS).
I tried (as I found in this site) to set eclipse to use Parallel GC. I tried put it in the eclipse.ini file, I tried to put in the glassfish VM arguments itself, and I tried to put it at eclipse JDK additional VM arguments (preference -> installed JRE-> JDK -> etc). Nothing seem to work for me. I also tried them all together.
Help me please..
Thank you all from advance,
Ido
EDIT:
OK, I noticed few more things:
On the Debug view, in my stck trace, I found the exact class with the breakpoint is paused and it had this comment: "(Suspended breakpoint at line XX)". When I clicked the line, suddenly the green line appeared. Yet, as soon as I clicked F6 to continue, It went out of sync again, just the next line became suspended. Weird.
I checked the processes running on my computer and found that there are several "java.exe" processes running at the same time. (eclipse runs on javaw.exe). Maybe this is why glassfish and eclipse refuse to work together.
I checked the build path and found that this is my output folder: project-name/target/classes. Is this good?
Any thoughts?
Ido
So, I couldn't fix this but I found a workaround that completely solves this - FINALLY!.
I just stopped using glassfish WTP for debugging and set a remote debug to my local glassfish. it works perfectly with few minor annoying things - but breakpoints finally noticed.
Set remote debug
Go to your glassfish admin console and set your glassfish to work on debug mode.
Click on configuration --> server-config --> JVM settings, and check debug enabled check box.
Restart server
In eclipse - start server on normal mode (not debug - it is useless).
Go to Debug configurations and locate "Remote Java Application"
Create a new Remote java app debug config
Enter name (lets say Glassfish-Debug)
Choose project to debug
Enter your own IP address in the host section and set the port to 9009
This is optional but it is more comfortable to work with:
Go to "Common" tab, and check the Debug check box. This will make this Glassfish remote debugging configuration constant on your debug menu.
That's it. Now all you have to do is always start your Glassfish in normal mode and then go to Debug configurations and run This Glassfish remote debugging you just set.
And now I'm getting to the annoying part: After rebuild your project, sometimes you might get again out of sync. You just need to disconnect the remote debugging session and run it again. Small price to pay.
I hope it helps..
I had faced similar issues, But it turned out to be a simpler problem of multiple versions of JREs/JDKs installed.
Try Debug -> Run Configuration -> JRE -> Alternate JRE -> select JDK 1.6.0_24.
Also check for project build paths if correct Jars are been used.
Hope this helps.
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.