Eclipse debug in a wrong file? - java

I'm using eclipse and a problem confused me. I downloaded the project from svn and for the first time I tried to do the debug, "ClassNotFoundException" occurred. Even the file is in my project. So I added the file path and then I could do the dubug, BUT instead of the original file, the debug is executed in another file whose icon is a light blue "J".
As you can see in the image, the left one is the original file, the right one is where the debug is executed. The right icon is light blue. I think it indicate that the file is not in the project.
Now there are two problems, the first one is sometimes the "light blue" code is not the newest. The other problem is I cannot watch the expressions in the file.
Does anyone know how can I solve these problems? Thank you guys!

This could be due to build path, check the order of classpath entries , remove the library if you have added original project as a dependency.

Related

How to get rid of Desktop Manager beside the project name when creating new projects in Eclipse?

When I create new Project in Eclipse, it displays the Desktop Manager beside the project name by default. How can I get rid of it?
If I understand your problem correctly, you're seeing the file location next to the file name. It looks something like this, perhaps?
There are a handful of ways to get rid of the location tag, but the most correct one (the one Eclipse wants you to use) is for you to put the project in the default location.
That results in a project name having no location tag. It also helps Eclipse find your projects later.
A caveat: since I do not have a screenshot of your problem and I do not know which Eclipse version you are using, nor what compoents you've added, I might be thinking of the wrong tag. If so, please add those details and I'll continue trying to help.

Can't find the path specified of a font

Firstly i'm 99% certain my path isn't wrong since it's the copied qualified path of the font file. I have no clue why java can't find the file, please help?
Picture of the error code and my code to load up the font
http://i.imgur.com/uEcAIxd.png
The problem is likely that the 1game project isn't on the classpath for your Eclipse run configuration.
Since you're using Eclipse: Click on the little triangle next to the debug symbol or run circle. Then click on Debug Configurations/Run Configurations. Select the run configuration you've been using. Go to Classpath, select User Entries, and then click Advanced. Add folders, then select the root folder for your project (1game). Try running the run configuration again.
It should be noted that this is only a solution to get your code to run provided that the folder where the file in question exists will also exist at the same path after you've deployed your code. Since you've hard-coded the path in, I'm assuming this is the case. However, you might want to confirm. If the resources will be packaged in the jar with the rest of your code, you'll want to use Assets.class.getResourceAsStream instead of a File (Thanks to MadProgrammer for pointing this out).

.class file isn't syncing with .java file when debugging

I might be using the wrong term when talking about "sync" but that's the best way to descrie it I think. I'm trying to debug a project that I've been working on for a couple of days now but for some reason the .java class and the .class file aren't syncing (.class file isn't updating to any of the changes that I make to the .java class that I'm editing). Let me start from the beginning I guess, when I do add break points to my .java file (sometimes the breakpoints are skipped) that I'm debugging and run the debugger when the breakpoint is reached the .class file is opened in instead of the .java file.
I searched around and found the solution to that with the help of some topics on here, which was "Edit source lookup". So the part about .class opening instead of .java file instead was solved. The main problem now is when I do edit the .java file with anything and run the debugger it completely ignores my changes. For example, if I implement a System.out.println("Test: 1") before a breakpoint or even after it's not printing to the console. Another example is if I comment out a line of code and run the debugger, the debugger still executes that line of code that I just commented out.
I searched for some solutions but they didn't help much. Some things I've tried were but did'n work:
Why isn't Eclipse updating the classes?
1.) Make sure the Build automatically is checked
2.) Cleaning the project
3.) Refreshing the project, F5
4.) Go to Wwindows->Preferences->General->Workspace and making sure the first 2 checkboxes are checked.
5.) Saving
6.) Restarting ecslipse
If anyone knows how to maybe solve my propblem I will be indebted to you. By the way I'm using java 1.7
What you describe indicates problems in you project definition.
Make sure that your project (main runnable class) specifies correct dependencies - that it does not specify dependencies on other jar files but includes dependencies from your related projects

libGDX not setting up the "__libgdx_setup_tmp" file

Screenshot of what is appearing:
So after creating a new project, this is what I'm met with. When I import the project to eclipse, it's still a rar file, rather than an actual project that I can expand.
Here's a picture of what I just described:
How do I go about fixing this? I read that I need to go into the directory and make it so that "write" is enabled, so it can create it, but that option was already checked. So I'm confused on what my next step should be.

Executable jar file won't run after doing some updates

I am working on Java project (A terraria like sandbox game) and I have come across something that I just don't understand. I have been exporting the project as .jar's as I go along to upload and share with my friends, but the last time I did this, the .jar won't run, but when I run it in eclipse, it runs fine. When I try to run the jar all it does is lose focus on the explorer window for a split second, then goes back. I have tried many things, like changing the main class, changing the META, and moving the files to specific packages, but nothing is working.
The project is 9 classes, so I won't paste all the code for it here, but the latest, non-working source code can be found here (http://www.mediafire.com/?fiw6wq73j7cff4t), the non-working jar here (http://www.mediafire.com/?bhjo162oh3hi2j9), and the working jar here (http://www.mediafire.com/?h918s8xpyxw4psr). If someone with more experience in java could please take a look at this it would be much appreciated.
One of the things I tried was not adding the JPanel (the game), and just leaving the splash screen, and the jar worked. This shows that it must be a problem in the coding somewhere.
Thanks for the time,
I.D.
Couldn't find message comes from your ReadMap class. So check which circumstance leads to this error. Most likely you did not add all classes or other files to your JAR, so file is not found. Check that all needed files are added to exported JAR in Eclipse export dialog. It's also a good idea to provide more debugging info (stacktrace is ok), especially when you are studying. BTW, cool game :)

Categories