JBox2d TestbedMain.java "Selection does not contain a main type" - jbox2d

I have installed JBox2D through Maven on Eclipse Juno and in order to test the installation worked correctly, I am supposed to try running the TestbedMain.java but Eclipse keeps giving me the error "Selection does not contain a main type" and sometimes "Editor does not contain a main type". I have tried closing and reopening both the project, the file and Eclipse and nothing has helped. If anyone has any idea why this would be happening or how I could fix it, then I would be very happy to try. I am also just getting around to learning Eclipse a bit more in depth so if there is something that is a more in depth step, please spell it out for me.

Make sure you import all the projects as Maven project, so you should see 4 projects listed. Then make sure you're right clicking on the testbed or testbed-jogl projects :)

Related

IntelliJ style problems after crashing

IntelliJ crashed for me, and in doing so it lost all of my files. They where still in the project folder itself and in git, but within the project window they where gone. I re-installed IntelliJ, and now there are several style issues.
The first is that used code is being marked as unused, and the second is that the colors for the styles are not being displayed either. This is with the new Scala plugin as well (3.0.3). I have already tried clearing the cache to no avail.
EDIT: Throw into the mix IntelliJ isn't compiling either so Im unable to even go to definition anywhere now.
When I see this sort of problem in Intellij, I first try "Refresh all SBT projects." Before I discovered where that was, I used to add a blank to build.sbt and then opt to Refresh at the prompt that popped up. Something similar exists for Maven projects, but I don't have experience with those. In more extreme situations, deleting the project and reimporting use "Import Project" has worked.

Eclipse: false error with jdk7

I've been having a problem with eclipse that's been stressing me a lot. Whenever I start a new Java porject, everything goes smoothly and perfect, until I "clean" the project (Project -> Clean...) and everything goes to ##~%&...
I keep getting:
XYZ cannot be resolved to a type
Multi-catch parameters are not allowed for source level below 1.7
<> operator is not allowed for source level below 1.7
That's very nice, only that I am importing all required classes and I do have 1.7 since the begginig. It's the only version I've installed. I've already tried this and other similar responses for the last few days with no avail.
A solution was to create a new project, copy and paste all packages/clases, which worked for a while, but I added UMLet to the project and again... Removing UMLet plugin did nothing for me.
BTW, even with the "errors", my project runs without any problem, therefore I know they're not real. I could keep working, but then, I can't see when a real error arises...
Does anyone got a final solution to get rid of this false errors?
EDIT:
I forgot to mention that I'm working with Kepler.
EDIT 2:
Here are screen captures with the requested information.
You can solve this by setting up correct JRE environment in Eclipse as below.
Go to Project => Properties => Java Build Path
Click on Libraries
Select JRE System Library
Click on Edit button at right hand side
Set Execution Environment to Jave SE-1.7(jre7)
Clean project or refresh project.
A solution was to create a new project, copy and paste all packages/clases, which worked for a while, but I added UMLet to the project and again...
One possibility is that the UMLet plugin is the cause of your problems. Try a clean Eclipse install without UMLet. (The fact that uninstalling the UMLet plugin didn't fix the problem is in no way conclusive.)
Note that UMLet will run as a stand-alone tool.
BTW, even with the "errors", my project runs without any problem, therefore I know they're not real.
The likely explanation for that is that the compilation errors come from the incremental Java compiler that is built into Eclipse. A different compiler (i.e. the one from your installed / configured JDK) is used to generate the ".class" files.
Multi-catch parameters are not allowed for source level below 1.7
not a solution, to this issue, but if you want to have two exceptions you can code it like this:
try {
// code here
} catch {
// code here
} catch {
// code here
}
it worked for me, instead of having catch (exception1 | exception2 e)

Eclipse IDE - Open Call Hierarchy is empty/broken

What should I do, if the "Open Call Hierarchy" is broken (empty for every method in a project)? It only shows the name of the method I wanted to see the call hierarchy for. This happens for all methods I try, even though they are all called by other methods.
It is very useful for code navigation. I do not know how to work without it!
I've tried:
Opening eclipse.exe -clean -refresh
Restarting Eclipse
Closing and reopening the project
Updating the project
Renaming the .metadata file
I've checked that it searches the whole workspace, and there are no filters on.
The following may help:
Calling eclipse with eclipse.exe -clean -refresh forces Eclipse to rebuild the index. After that the feature worked again.
Closing and re-opening the project.
I also tried the suggestions above, as well as the hint given here: http://mschrag.blogspot.co.at/2009/01/open-type-cant-find-your-class.html
Nothing worked until today when I found out that I am a donkey...
I once configured a filter in the "Call Hierarchy" view and so no entries were shown because filtered out. Once I removed / disabled the filter everything worked fine again.
When you go to the eclipse bug report for this issue, somebody says, you should install over the Market place the Java 12 support.
When I installed it, it was working properly again
Also, you can try to delete the workspace and get it recreated. Make sure all your projects are backed up.
For Kepler and PDT (PHP IDE) it is broken in at least PDT 3.2.0 and 3.3.0 (tried them both). The fix is in 3.3.1 and updating to that was all I had to do get the call hierarchy working again.
(apologies, I'm not yet allowed to add comments, however this should prove handy to many)
In my case it seemed my workspace was contaminated.
Opening/closing projects and starting with clean did not fix. I had to start off a new workspace.
Fedora 20, Eclipse Kepler.
I have the same behavior with eclipse Kepler (4.3.2).
I found out, that there is a bug with methods with signature of:
void get(Object o)
Object get(Object o)
In the eclipse Error Log view I find the following exception:
java.lang.NullPointerException
at org.eclipse.jdt.internal.core.search.matching.ClasspathSourceDirectory.directoryTable(ClasspathSourceDirectory.java:52)
at org.eclipse.jdt.internal.core.search.matching.ClasspathSourceDirectory.findClass(ClasspathSourceDirectory.java:109)
at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.findClass(JavaSearchNameEnvironment.java:146)
at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.findType(JavaSearchNameEnvironment.java:185)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:145)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:197)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2799)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:2556)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.getType(MatchLocator.java:899)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.getMethodBinding0(MatchLocator.java:955)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.getMethodBinding(MatchLocator.java:907)
at org.eclipse.jdt.internal.core.search.matching.MethodLocator.matchMethod(MethodLocator.java:327)
at org.eclipse.jdt.internal.core.search.matching.MethodLocator.resolveLevel(MethodLocator.java:664)
at org.eclipse.jdt.internal.core.search.matching.ClassFileMatchLocator.locateMatches(ClassFileMatchLocator.java:209)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:1699)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1143)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1184)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1301)
at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:95)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:231)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:515)
at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:584)
at org.eclipse.jdt.internal.corext.callhierarchy.CallerMethodWrapper.findChildren(CallerMethodWrapper.java:155)
at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.performSearch(MethodWrapper.java:301)
at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.doFindChildren(MethodWrapper.java:232)
at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.getCalls(MethodWrapper.java:84)
at org.eclipse.jdt.internal.ui.callhierarchy.DeferredMethodWrapper.getCalls(DeferredMethodWrapper.java:65)
at org.eclipse.jdt.internal.ui.callhierarchy.DeferredMethodWrapper.fetchDeferredChildren(DeferredMethodWrapper.java:79)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
In the end, it looks like a bug in this version:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=401272
I assume, that upgrading at least to version 4.4 (Luna) will solve this problem.
In my case I was trying to get the call hierarchy of a method in the derived class of an abstract class. The requested method was declared abstract in the base class.
When I opened the call hierarchy directly on the abstract method instead of the implemented one, everything worked well. (Eclipse Neon).
My problem was that Open Call Hierarchy was searching only the project not the entire Workspace.
So I had to click on the small down arrow (in the Call Hierarchy view window on the right; it is the "View Menu" arrow -- a triangle pointing down) in Call Hierarchy view, set the Search Scope > Workspace.
Tried everything in all the answers here, but none of them worked for me. Later I figured out that this was a bug in Eclipse 2019-03 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=545293). Try to upgrade your eclipse or install a newer version.
For me installing a newer version(latest version Eclipse 2019-09) solved the problem.
I tried many answers all were great, it helped many except few and I was in few.
My eclipse version is 2019-03(4.11.0). This is which has a bug. Which can be fixed by add-ons.
Go to the Eclipse Marketplace and search for plugin java 12 Support for Eclipse 2019-03(4.11)… and install it. On completion of installation restart the eclipse. Hopefully this will fix the problem. Have a nice day.
If the call Hierarchy is not opening, it might be because of the project is not imported as a java project, rather it would be displayed in the file stucture. You may want to enable the project facet through:
right click on the project -> project facet.
If you dont see anything listed, you need
configure the project facet -> Apply -> ok.

Jump to declaration does not work properly

I use Eclipse PDT with Aptana. When I started working, I could reliably use ctrl-click (or F3) on method names or functions to directly jump to the declaration.
Today, suddenly this does not work any more for all methods, it just works for some. I could not find out for which it works, yet.
I have already refreshed the project (F5 in PHP explorer window) and started eclipse with the "-clean" option, but neither helped. Hyperlinking is actived in the settings.
EDIT: I am using Helios Service Release 1, Build id: 20100917-0705
What can I try to make it work again?
Did you update Eclipse?
"Remove files under workspace/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2
Kepler repository has newer version of h2 database. It is incompatible to older one.
See eclipse/plugins folder, there might be org.h2_1.1.117.v201105142352.jar and org.h2_1.3.168.v201212121212.jar. (don't touch them)"
Okay, it looks like it was a user fault. My fault ... I had too many projects opened at the same time. Now, when I have only one project open, the hyperlinking works quite well again. I will watch further, but I am quite hopeful that I can now enjoy the full functionality of eclipse again.
What did the job for me was this:
http://fsse8info.wordpress.com/2013/10/14/howto-get-eclipse-pdt-open-declaration-f3-working-again-with-php-files/
Closing unrelated projects worked for me too, I was actually facing 2 issues.
Both intelligence ( ctrl+space) and open declaration were not working. After clicking (right click->close unrelated project), Problem solved for me as well.
If all above solutions don't work and still facing issues with some directories. Then you need to make sure .buildpath doesn't miss any directory and have all entries like:
buildpathentry kind="src" path="dir/dir1"
buildpathentry kind="src" path="dir/dir2"
Your file has errors from classes missing a library reference. Right click project, Java build path, add library to fix reference issues, then the ctrl+click will work again

Eclipse give error in my project

I think that my Eclipse is trying to destroy my brain.
Actually I'm creating a project from a svn trunk and everything worked fine till this morning when I opened Eclipse and it said me that there is an error, the I opened all the class and packages to find where it is but there are no red asterisk so, where is the problem?
Help me please!
Use the Problems view to isolate the issue.
Sometimes Eclipse declares warnings as errors in order to draw your attention to them, you can reduce the warning level by changing the Compiler settings in your project properties. Also, you may have changed the location of your JDK which could be leading to incompatibilities between JDK1.5 and JDK1.6 at compile time.