Java Error When Starting Eclipse - java

Every time I start Eclipse on my laptop running Fedora 20, a new log file is created in the same folder where Eclipse was started with a name like abrt_checker_xxxx.log where xxxx is a different 4-digit number. Inside the log file there is always the same error:
Uncaught java.lang.ClassNotFoundException exception in thread "main" in a method java.lang.ClassLoader.loadClass() with signature (Ljava/lang/String;Z)Ljava/lang/Class;
Exception in thread "main" java.lang.ClassNotFoundException: .home.raffy.eclipse..plugins.org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/net/URLClassLoader$1.class]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/net/URLClassLoader$1.class]
at java.security.AccessController.doPrivileged(Native Method) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/security/AccessController.class]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/net/URLClassLoader.class]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/lang/ClassLoader.class]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/sun/misc/Launcher$AppClassLoader.class]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/lang/ClassLoader.class]
This happens when running Eclipse on both OpenJDK 7 and Oracle JDK 7. It did not happen when I had Fedora 19 with the same exact set up.

Not really an answer to your question, but I have always seemed to have had issues using OpenJDK in linux for eclipse and netbeans. I never could really pinpoint the issue because there were always different issues, and the issues did not always persist. I ended up finding a repository to get and use the standard Java Development kit.
Which for the most part played much nicer.

I was able to eliminate the symptoms only (the log file being created after every Eclipse start) by removing a package called abrt-java-connector from Fedora.
sudo yum remove abrt-java-connector
Like I said, this only removes the symptoms. The underlying problem is either with Fedora 20 or Eclipse and hopefully can be resolved in future versions.
The problem is not related to my set up because I was able to recreate the same problem by doing a fresh install of Fedora 20 and a fresh install of Eclipse on a completely separate laptop.

I suggest you to read the Known Issues section of the readme_eclipse.html file which is located in eclipse/readme folder. It surely suggests which jdk version is required for your current eclipse installation and you may check if it matches. I strongly believe that your eclipse has mismatches with JDK like 64-bit version of jdk and 32 bit eclipse, or vice versa.
ADD path of jre and bin:
Fix JAVA_HOME as well as PATH variables ?

Do you have Google Talk installed? If so, try uninstalling it and try again. It's a webkit issue on Fedora 20.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334466

It's an issue with gtk styles, probably you are using KDE and the gtk theme is oxygen-gtk.
Try setting the themes to defaults. It worked for me.
rm .gtkrc-2.0*
Sources:
http://forums.fedoraforum.org/showthread.php?t=295967
https://bbs.archlinux.org/viewtopic.php?pid=1363455#p1363455
http://forums.zend.com/viewtopic.php?f=59&t=114903

Related

How to solve exceptions <WindowsNativeRunloopThread> and <JavaFX Application Thread> on build [duplicate]

I have been testing JavaFX 11 using Maven and cannot get it to work. I have Open JDK 11 installed and if adding jars to build path from downloadable .zip everything works just fine.
However when I use the recommended POM file from the javafx 11 site I get the following error.
Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError: <init>
at javafx.graphics/com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Method)
at javafx.graphics/com.sun.glass.ui.Screen.initScreens(Screen.java:412)
at javafx.graphics/com.sun.glass.ui.Application.lambda$run$1(Application.java:152)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at javafx.graphics/com.sun.prism.d3d.D3DPipeline.getAdapterOrdinal(D3DPipeline.java:205)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:695)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:313)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:258)
at javafx.graphics/com.sun.glass.ui.Application.lambda$run$1(Application.java:153)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
This problem seems to have cropped up once here but none of the solutions in that thread have worked.
Does anyone have suggestions on how to go about diagnosing the problem? I am running in Eclipse 4.9 and have attached a screenshot of two projects which are identical other than one uses maven and the other has jars added to the build path. Any help much appreciated.
The solution to this problem is in comments (kleopatra). For quick reference you need to add
-Djava.library.path=C:/anywhere-outside-eclipse
(I tested using -Djava.library.path=C:/) to the VM arguments. This means javafx 11 works with Maven inside eclipse.
This is not Eclipse only problem. I have exactly the same issue when running OpenJFX app in Intellij IDEA 2018.3.2. If any other Java version specified in Windows %Path% env variable then forementioned exception will be thrown.
For instance I use Java 8 as default SDK and playing with Java 11. It's not working that way. It work only if I'll delete Java 8 bin directory from %Path%.
This is rather confusing (and I believe it's a bug) because I don't see any relations to Java 8 when I launch my project in IDE:
C:\Software\Java\openjdk-11\bin\java.exe -Dmaven.multiModuleProjectDirectory=C:\Project\helloworld -Dmaven.home=C:\Software\Maven\3.6.0 -Dclassworlds.conf=C:\Software\Maven\3.6.0\bin\m2.conf "-javaagent:C:\Software\IntelliJ IDEA\CE_2018.3.2\lib\idea_rt.jar=64808:C:\Software\IntelliJ IDEA\CE_2018.3.2\bin" -Dfile.encoding=UTF-8 -classpath C:\Software\Maven\3.6.0\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2018.3.2 -T 2 -DskipTests=true exec:java
As suggested in the post linked to by #kleopatra, the problem is that javafx11 is loading the wrong glass.dll file.
While the workaround suggested in other answers works, the OpenJFX tutorial suggests, when possible, to instruct eclipse to use the Java 11 VM to run, so that the correct dll is loaded.
You can modify your eclipse.ini file and (supposing your jdk11 is installed in C:\Program Files\Java\jdk-11.0.2) add the following lines:
-vm
C:\Progra~1\Java\jdk-11.0.2\bin\javaw.exe
Adding the following lines in the pom.xml file have resolved this issue for me.
In the POM file for the ArtifactID -- javafx-maven-plugin add the following lines in the configuration tag section.
<options> <option>-Djava.library.path=C:\tmp</option> </options>
<executable>C:\openjdk11\jdk-11\bin\java.exe</executable>
Create the tmp folder in advance before you make the change to pom.xml file. Also ensure that java11 is present in the path mentioned above. otherwise mention the path according to the java11 path in your system.
Context: NetBeans IDE 8 and 11 on Windows 10
I had the same problem, but my context was slightly different from the above. I do a lot of work switching between various versions of Java: supporting legacy applications in Java 8 and developing new applications in Java 11.
As it turned out, I had the Java 8 entry in the PATH while trying to develop and run a Java 11 application. The builds completed successfully but at runtime it was exceptions galore. All NB console logs and other logs indicated a Java 11 environment. I removed the Java entry from the PATH and then had to restart NB 11. Everything worked fine.

JavaFX 11 using Maven throws Exception: "WindowsNativeRunloopThread"

I have been testing JavaFX 11 using Maven and cannot get it to work. I have Open JDK 11 installed and if adding jars to build path from downloadable .zip everything works just fine.
However when I use the recommended POM file from the javafx 11 site I get the following error.
Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError: <init>
at javafx.graphics/com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Method)
at javafx.graphics/com.sun.glass.ui.Screen.initScreens(Screen.java:412)
at javafx.graphics/com.sun.glass.ui.Application.lambda$run$1(Application.java:152)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at javafx.graphics/com.sun.prism.d3d.D3DPipeline.getAdapterOrdinal(D3DPipeline.java:205)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:695)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:313)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:258)
at javafx.graphics/com.sun.glass.ui.Application.lambda$run$1(Application.java:153)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
This problem seems to have cropped up once here but none of the solutions in that thread have worked.
Does anyone have suggestions on how to go about diagnosing the problem? I am running in Eclipse 4.9 and have attached a screenshot of two projects which are identical other than one uses maven and the other has jars added to the build path. Any help much appreciated.
The solution to this problem is in comments (kleopatra). For quick reference you need to add
-Djava.library.path=C:/anywhere-outside-eclipse
(I tested using -Djava.library.path=C:/) to the VM arguments. This means javafx 11 works with Maven inside eclipse.
This is not Eclipse only problem. I have exactly the same issue when running OpenJFX app in Intellij IDEA 2018.3.2. If any other Java version specified in Windows %Path% env variable then forementioned exception will be thrown.
For instance I use Java 8 as default SDK and playing with Java 11. It's not working that way. It work only if I'll delete Java 8 bin directory from %Path%.
This is rather confusing (and I believe it's a bug) because I don't see any relations to Java 8 when I launch my project in IDE:
C:\Software\Java\openjdk-11\bin\java.exe -Dmaven.multiModuleProjectDirectory=C:\Project\helloworld -Dmaven.home=C:\Software\Maven\3.6.0 -Dclassworlds.conf=C:\Software\Maven\3.6.0\bin\m2.conf "-javaagent:C:\Software\IntelliJ IDEA\CE_2018.3.2\lib\idea_rt.jar=64808:C:\Software\IntelliJ IDEA\CE_2018.3.2\bin" -Dfile.encoding=UTF-8 -classpath C:\Software\Maven\3.6.0\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2018.3.2 -T 2 -DskipTests=true exec:java
As suggested in the post linked to by #kleopatra, the problem is that javafx11 is loading the wrong glass.dll file.
While the workaround suggested in other answers works, the OpenJFX tutorial suggests, when possible, to instruct eclipse to use the Java 11 VM to run, so that the correct dll is loaded.
You can modify your eclipse.ini file and (supposing your jdk11 is installed in C:\Program Files\Java\jdk-11.0.2) add the following lines:
-vm
C:\Progra~1\Java\jdk-11.0.2\bin\javaw.exe
Adding the following lines in the pom.xml file have resolved this issue for me.
In the POM file for the ArtifactID -- javafx-maven-plugin add the following lines in the configuration tag section.
<options> <option>-Djava.library.path=C:\tmp</option> </options>
<executable>C:\openjdk11\jdk-11\bin\java.exe</executable>
Create the tmp folder in advance before you make the change to pom.xml file. Also ensure that java11 is present in the path mentioned above. otherwise mention the path according to the java11 path in your system.
Context: NetBeans IDE 8 and 11 on Windows 10
I had the same problem, but my context was slightly different from the above. I do a lot of work switching between various versions of Java: supporting legacy applications in Java 8 and developing new applications in Java 11.
As it turned out, I had the Java 8 entry in the PATH while trying to develop and run a Java 11 application. The builds completed successfully but at runtime it was exceptions galore. All NB console logs and other logs indicated a Java 11 environment. I removed the Java entry from the PATH and then had to restart NB 11. Everything worked fine.

NoClassDefFoundError and NullPointerException when opening a project with PhpStorm on OS X Sierra

Recently installed PhpStorm 2017.2.4 on my Mac Pro (Sierra 10.12.6), Java version is (9+181).
Whenever I try to open a project, PhpStorm hangs.
I took a look at the log file situated in /Library/Logs/PhpStorm2017.2.
There are several NoClassDefFoundError happening, with a slice of NullPointerException.
Here are a few excerpts:
java.lang.NoClassDefFoundError: com/apple/eawt/AppEvent$AboutEvent
java.lang.NoClassDefFoundError: com/apple/eawt/OpenURIHandler
java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
java.lang.NoClassDefFoundError: Could not initialize class com.intellij.credentialStore.kdbx.KdbxKt
java.lang.NullPointerException at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.b(ToolWindowManagerImpl.java:1800)
java.lang.NullPointerException at com.intellij.codeInsight.daemon.impl.DaemonListeners$MyProfileChangeListener.a(DaemonListeners.java:519)
I tried to change the target java version in the info.plist configuration file inside the PhpStorm package.
I also followed these instructions in order to be able to start the application.
Just to check I also installed Webstorm, which worked perfectly out of the box.
After doing some research, it looks like no one else is having this problem. I really need some inspiration, some crazy idea to try.
PS: I uploaded the log file here if anyone feels like wading through it.
Found a better solution, you can install PhpStorm with homebrew
homebrew cask install phpstorm
Worked like a charm.
I'm leaving the old answer, just in case someone needs this kind of information.
Ooookay, I got it working. But that was not pretty.
So for some reason PhpStorm is not able to use its own bundled JDK. It's trying to use the system's default JDK, which is Java 9 for me.
Therefore i did something a bit extreme, I replaced the lib folder in the system's JDK by a symbolic link pointing to the jre lib folder inside the Phpstorm.app package
sudo ln -s /Applications/PhpStorm.app/Contents/jdk/Contents/Home/jre/lib /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib
Needless to say that you should not use this method if you have other applications using the system's JDK.
Thanks to LazyOne, whose comment gave me the 'aha!' moment.
PS: if anyone needs this information, I also had to give executing permissions to fsnotifier in order to be able to browse files within the IDE
chmod 744 /Applications/PhpStorm.app/Contents/bin/fsnotifier
I had this with Intelli-J when upgrading the jdk it runs on to 11.
I changed the jdk it runs on back down to 8 by following the instructions here:
https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under
Might also need this link too for the config files locations
https://intellij-support.jetbrains.com/hc/en-us/articles/206544519

Amazon Mechanical Turk (AMT) command line tools and and Java versions

I'm trying to install Amazon Mechanical Turk command line tools on Ubuntu 14.04 LTS, using this tutorial. It requires Java, so I installed OpenJDK7. However, when attempting to run the command , I get the following error, which the internet informs me indicates the wrong Java version.
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at com.amazonaws.mturk.service.axis.AWSService.<clinit>(AWSService.java:104)
at com.amazonaws.mturk.cmd.AbstractCmd.initService(AbstractCmd.java:119)
at com.amazonaws.mturk.cmd.AbstractCmd.run(AbstractCmd.java:143)
at com.amazonaws.mturk.cmd.GetBalance.main(GetBalance.java:28)
Some of the documentation for the AMT tools indicates that I need JRE 1.5 (while others say "most recent version"), so I have been trying to install that. Since it's no longer available through apt-get, I downloaded the bin file and installed it at '/home/USERNAME/', (I don't use the machine much and didn't want to deal with sticking it at the end of a long chain of folders, so all my AWS stuff is in there) then put in my AWS keys and set the environment variables:
export JAVA_HOME="/home/USERNAME/jre1.5.0_22"
export MTURK_CMD_HOME="/home/USERNAME/aws-mturk-clt-1.3.1"
Then, checking my balance to make sure everything is configured, as specified in the AWS Getting Started PDF, I still get the same error shown above.
Did I do something wrong when installing JRE 1.5? Is it still using OpenJDK7, or is JRE 1.5 also no good? I'm really at my wit's end here.
It turns out that I am an idiot and installed Java wrong.
Instructions for anyone else having this problem: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

Intellij IDEA 12 slow response

I've upgraded to IDEA 12 and become frustrated with the slow response. Class navigation takes several seconds to populate the search list (previously it was instantly), any dialog relevant to file list operation hangs for minutes. Move a class to another package just hang up and I have to kill the process. Does anyone have the same experience with me?
Additional information:
I am on windows 7
I tried both 64 and 32 versions and both have the same issue
My 64bit vmoption file has the following configuration:
I have the log dir zipped and put on http://ge.tt/1JwgAnU/v/0. When I start to generating the log dir, I clean it first and then start IDEA 64 bits, open a project (automatically), then invoke File > import module command. I observed there are around a minutes delay before the dialog popped up. And inside the log dir I see a threadDumps-20130106-091041-IU-123.100 folder. However there is no exception found in the idea.log file.
Updates
A screenr showing IDEA hang up when trying to move one class to another package by drag and drop: http://www.screenr.com/zlA7
I found the problem is caused by JDK 8 ea installed in my windows 7. IDEA use exe4j to load JDK, which automatically picked up JDK 8 (See this question).
After I defined IDEA_JDK_64 environment variable and point that to my JDK 6, a high performance IDEA comes back!
I had the exact same, but solved it by changing a setting the idea64exe.vmoptions:
from...
-XX:ReservedCodeCacheSize=64m
...to...
-XX:ReservedCodeCacheSize=256m
I had this problem with RubyMine (uses the same codebase) and it was because my system had swiched to OpenJDK instead of Sun/Oracle JDK.
I see that someone had similar problems in this thread: OpenJDK or Sun Java for IntelliJ IDEA
Specifically, do you see something like the following when you start your IDE from the terminal?
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b24~pre2-1)
OpenJDK Server VM (build 20.0-b12, mixed mode)
WARNING: You are launching IDE using OpenJDK Java runtime.
THIS IS STRICTLY UNSUPPORTED DUE TO KNOWN PERFORMANCE AND GRAPHICS PROBLEMS!
NOTE: If you have both Oracle (Sun) JDK and OpenJDK installed
please validate either IDEA_JDK, JDK_HOME, or JAVA_HOME environment variable points to valid Oracle (Sun) JDK installation.
See http://ow.ly/6TuKQ for more info on switching default JDK
Press Enter to continue.
Perhaps you should check if the upgrade caused the IDE to revert to a non-Oracle JDK.
In my case it was a Findbugs plugin that caused frequent lags. You can see this if you run IDEA from the terminal and look at the log output, e.g.
No classfiles specified; output will have no warnings
After disabling the real-time Findbugs scans (Settings -> Inspections -> Findbugs IDEA) everything ran smoothly again.

Categories