NetBeans docs at http://docs.oracle.com/javase/tutorial/getStarted/cupojava/netbeans.html say:
If the build output concludes with the statement BUILD FAILED, you probably have a syntax error in your code. Errors are reported in the Output window as hyper-linked text. You double-click such a hyper-link to navigate to the source of an error. You can then fix the error and once again choose Run | Build Main Project.
However, in NetBeans 7.0.1, the hyperlinks are mostly missing. (I'm running in Linux Mint 12.) The errors are plain text and navigating to them is a pain. This is true for all errors except for two at the end which are hyperlinked. The two that are hyperlinked are of no immediate use to me. They are:
/home/user/Workspaces/MyApp/client.git/nbproject/build-impl.xml:603: The following error occurred while executing this line:
/home/user/Workspaces/MyApp/client.git/nbproject/build-impl.xml:284: Compile failed; see the compiler error output for details.
All the places I need to edit in the code are mentioned by file and line number, but are not hyperlinked:
MyApp.java:40: cannot find symbol
symbol : constructor MainView(com.example.desktopclient.MyApp)
location: class com.example.desktopclient.MainView
MainView mainView = new MainView(this);
Does anyone know anything about this issue. I searched but didn't find anything relevant.
EDIT: I'm NOT looking for help with the code errors! I want to find out why NetBeans isn't working correctly.
Related
I just imported a Java EE project that I made about a year ago. But after I imported it, i get this error in the first line of one of the files:
Internal compiler error: java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.problem.ProblemHandler.handle(ProblemHandler.java:148)
I am able to run the project on the server but it doesn't work, the website won't show up.
I tried removing the first line but I still get the same error.
I also get the same error during building.
There is no other error in the code, I can't post the entire code because it's around 3000 lines long.
Here is the project hierarchy:
I had the same problem and it turns out I was using lombok 1.18.18 and this version has a known issue:
https://github.com/projectlombok/lombok/issues/2752
This is an Eclipse Bug.
http://download.eclipse.org/eclipse/downloads/#4.8_Integration_Builds (Use newer than 2018-06-16).
Check your eclipse version in the above comment link and the NPE Should be gone.
This is shown in the console of MyEclipse when trying to run a simple "Hello world" program. Sort of surprised that noone has a solution yet.
I think this should be such a basic issue that should be addressed, but couldn't find it being resolved anywhere.
Problem:
I am getting the following error Message when trying to run a small Java program. I assume it might be a "setup error" or "compiler error" of my Eclipse but not sure. I cannot re-setup because I have enterprise Java being setup here. That took a boatload of time. So have to resolve without any re-installations and such.
In red it shows as:
Usage: java javassist.tools.reflect.Compiler
(<class> [-m <metaobject>] [-c <class metaobject>])+
To make sure that it is not an issue of my program, I made a new class where I tried to print "Hello World".. and still I get the same error message where it did not display the output.
So I figured it out myself. This is a Run configuration issue.
Right click your project --> Run As --> Run configuration --> Under the "main class" input box enter your fully qualified class name where your main() resides. Or the better way would be to click the "Search" button near to it and select the appropriate package.
Make sure it is running as a "Java Application" or under the correct "Server".
It should be resolved for the most part.
Anyways it is a Run configuration issue.
The following obviously incorrect code (inspired by #dexter's answer to a question of mine):
Class<? extends Exception>[] exceptions;
try {
// some stuff here
} catch (exceptions[0] e) {
// some more stuff here
}
causes Eclipse to frequently pop up a dialog box titled "Problem Occurred" with the following message:
'Building workspace' has encountered a problem.
Errors occurred during the build.
The dialog offers the following 'Details':
Errors occurred during the build.
Errors running builder 'Java Builder' on project 'test'.
org.eclipse.jdt.internal.compiler.lookup.ArrayBinding cannot be cast to
org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
Eclipse does place red squiggles under exceptions[0], but if I mouse over them, it doesn't have any error associated with them. Instead, it also places a red (x) in the very top of the margin and squiggles the first letter of the first line in the file (the p in package ...) and if I mouse over that, I get:
Internal compiler error: java.lang.ClassCastException:
org.eclipse.jdt.internal.compiler.lookup.ArrayBinding cannot be cast to
org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding at
org.eclipse.jdt.internal.compiler.ast.TryStatement.verifyDuplicationAndOrder
(TryStatement.java:1191)
Is this a bug in Eclipse? If so, what's the best place to report it?
Also (to make this question it useful to someone who runs into the same issue), is there a good way to locate the source of such a build error, if it's buried somewhere deep in the code? The only information I get from the error messages is the project name in the details of the dialog, which may not be too helpful if there are many other problems with the project (taking over someone else's work, for example). Are there other places, where I can find more information about the exact location of this error, like at least a file-name?
Here's a trick:
In my case the bug marked an X on one file user.java
So I opened up the file, highlighted everything and cut it, then saved so the X went away.
Then I pasted it back in.
Yes it looks like an Eclipse bug which you would report at https://bugs.eclipse.org/bugs/
Looking at existing bugs this class cast error has happened before but there are no open bugs for this error.
Looking at the jdt plugins there are a lot of debug options that can be turned on, I'm not sure which ones would be useful here.
A partial answer to help others who run into this problem and are having trouble tracking down the cause:
In Eclipse, open the "Problems" view via "Window -> Show View -> Problems". Expand the "Errors"-section in the view. This list contains all errors found in all projects that are currently part of the build process.
Most errors in the list will have a light-bulb with a small red [x] in the corner as their icon. Some will have a big red (x). One of those with the big red (x) will say "Internal compiler error: ...". If you double-click that entry, it will take you to the file that causes the error.
In my case, the "Errors"-list contains a second entry with a big red (x) right after the one labelled "Internal compiler error: ...". That one is the actual problem that causes the error, so double-clicking that will not only open the right file, but also jump to the offending location. (Not sure if this second entry will always be there, though...)
I get the following error when I try to start my code in the debugger.
EventDispatchThread.run() line: not available [local variables unavailable]
The code is very large and I can't publish it here but anyway here are some details:
This statement seems to crash and I can't step into the constructor with the debugger:
Satellite satellite = new Satellite();
When I put a breakpoint on this line and try to step into the constructor or step over I get the same error as above.
Here are parts of Satellite class implementation:
package tags;
import main.*;
import xml.*;
public class Satellite extends XMLElement {
public static final String[] ATTRIBUTES = {
"XmlFileVersion",
"SatelliteName",
"xmlns:xsi=#xmlns_xsi",
"xsi:noNamespaceSchemaLocation=#xsi_noNamespaceSchemaLocation"
};
public Satellite() {
super(ATTRIBUTES);
setTopLevelElement();
setAttribute("XmlFileVersion",ValueCenter.Satellite_XmlFileVersion());
setAttribute("SatelliteName",ValueCenter.Satellite_SatelliteName());
addElement(new SubSystemList());
}
}
I localized the problem somewhere in the line addElement(new SubSystemList()); . I added a breakpoint here and again tried to step in or step over and now I got a ClassNotFoundException. The debug cursor jumps to an empty window where "Source not found." is written but the Source is 100% available and I also got the corresponding .class files. The other thing is that the Eclipse IDE throws no errors on the syntax check.
I don't understand this. What can cause these errors and why can't I use the debugger to walk through the method calls?
I've updated the Eclipse Helios SR1 for Java Devs and installed the latest java version on my pc.
I know that the code has an endless loop anywhere in here because I get an StackOverflowError Exception if I run it without the debugger. But anyway, shouldn't it be possible to debug through the code, to investigate the real problem? Why is the debugger crashing with other errors or exceptions than a non debugger run?
btw: only one thread and sequential execution.
Hope someone can help.
Edit 1:
Some additional infos. My Workspace has two projects. In one there is the main program with the Satellite and others. In the other project I have many supporting classes like this XMLElement. This structure works for many classes.
By the way: I can step into the XMLElement.setAttribute method but I can't step into the XMLElement.addElement.
The other strange thing is that Satellite is in the same project as the main class but it's also not possible to step into the constructor.
Maybe this helps?
In Eclipse: Right-click the project and select Properties.
Here are the settings you have to change:
Also, find your Run Configuration using Run > Run Configurations ..., select the Source tab and make sure the current project is in the sources list. If not, click Add... > Java Project ...
EventDispatchThread.run() line: not available. This is a common error message for java desktop application developer, who are mainly working in Swing. I also got the same error message but the step you explained doesn't solve my prob.I got the same error message for another issue.That was OutOfMemoryError.So when you are getting this error message the problem you need to find yourself and it's not due to some particular issue.
I resolved this by fixing my Java Swing Code which was throwing NullPointerException.
I've just created a project on Eclipse and imported some source files (existing project). But I can't compile it ! Ok, the project has got several source files, so I wanted to compile only the Main.java file (with eclipse not in the command line, in the command line it worked!) but all what I get is this error :
http://www.screencast.com/users/Amokrane/folders/Jing/media/82d772dd-10cd-4552-b1d0-3cf18bf39f13
As you can see the Main.java file is straighforward, just a hello world !
What's the matter ?
Thanks
"Unresolved compilation problem" means that the class hasn't compiled successfully. Eclipse will still let you run code that doesn't compile, but any of the specific bits which don't compile will throw this error. Look in the "Problems" tab to see what's wrong.
From the look of the Package Explorer view, every single class has a problem... perhaps the file location doesn't match the package declaration? That would match the position of the pink box just to the right of the vertical scrollbar for the class - it suggests that the error is right at the top of the file, which is where the package declaration would be.
You have a compilation error at the top of your Main.java file, just out of sight in the screenshot. Probably an unresolvable import or a wrong/missing package declaration.
It is simple in my case that the imported project needs 32 bit jre to run but cannot be compiled in the same. In IDE, if you click run, it will try to compile and run the project in single shot so fails due to 32 bit jre for compilation with the above reported error.
So i used 64 bit compiler and started to run and got compiled successfully but thrown error that needs 34 bit jre for some of the SWT used in the project. Again i changed the 32 bit jre and run the project, it is gone ! THE ERROR IS GONE NOW !
You can get the error "Exception in thread "main"
java.lang.Error: Unresolved compilation problem:" if your public class name differs from your file name.
example:
File Name:
ServiceRequest.java
Inside file, class is named differently; like
public class Service