The error is as the pic showed:
Could you run it directly? It does not look like a problem with Java.
You can intentionally make a compile error and you can clearly see which provided this error message. Most of it was provided by the Java Language Server so you can find 'Java(xxxxx)' at the end of the error message. But the error message in the picture you have provided does not contains it.
So could you disable all extensions and then just enable Java-related extensions to check the error message still exists or not?
Remove public class and make it class only. IDE is showing error because You have same class name somewhere in another java file. I don't know why but this issue arise in VSCode. If you run your code using cmd than your code will show no error.
Related
I am developing a Java Library that is used in a Java GUI that is based on JavaFX.
During manual testing, I can produce the following Error, printed to the console - the GUI hangs, but the window stays open:
java.util.concurrent.CompletionException: java.lang.IllegalStateException: Cannot load xxx.xxx.xxx.main.tab.editor.workspace.canvas.canvas
No Stacktrace, no line number, no class that caused the exception, nothing that I can work with.
How do I get a stacktrace for this?
I tried the following things already:
Instead of running the packaged jar with java -jar Application.jar, I tried just running the main class with mvn exec:java -Dexec.mainClass="xxx.xxx.xxx.App"
I tried using the verbose flag: java -verbose -jar Application.jar
From other threads, I tried the -XX:-OmitStackTraceInFastThrow flag
Nothing changed the error message to be anything else than this single line.
Edit: The exception is not caught in the project's own code, however it might be caught by a library - so I hope maybe this is something done by JavaFX itself and there is a way to fix it? I guess JavaFX should be the main source of concurrency in the project.
I found the culprit, it is indeed the something JavaFX-y catching the error:
The class from the exception is a JavaFX...module (? component? whatever, it has a CanvasView and CanvasPresenter class and is in a folder that contains all the ressources like .fxml and .properties files, and it is really hard to google the basic concept)
The exception is thrown in the CanvasPresenter initialize method (CanvasPresenter implements the Initializable interface), and there I could wrap the offending code in a try {...} catch(Exception e) {e.printStackTrace();} and get more information.
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.
I have technical issue with my database. In SQL Developer there is an option designed to add Java code to database. But when I try to add my code, error message appears (shown below). Do you have any idea where I can find info about what comilation error is this? Some log maybe? And what are the requiments for good Java class? I tried to add Hello World code and it worked fine.
Error message: https://s4.postimg.org/if3ip9zfh/screenshot000213.jpg
It'll probably be easier to create a class via a script with DDL.
We do it like this:
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "IP6Address" AS
import java.math.BigInteger;
public class IP6Address
{
... -- whatever
}
/
We do that for packages as well because we store these scripts in VCS.
Then you just run the script and wait for the compiler messages (as with any other script).
I had the same issue as you, but the Oracle JDK version was a problem.
I fixed this problem by changing the source code to match the JDK version. Please check the version.
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.