Cannot launch CDT: java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter - eclipse

I am trying to use Eclipse CDT under Ubuntu 18.04 LTS.
I get the same error as many others, but I could not find a solution in what I read.
I try to launch with
$ eclipse &
OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
and I get
/home/user1/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1551271296090.log
When checking /usr/lib/eclipse/configuration/config.ini (as per this) I found the following lines (among others)
osgi.framework=file\:plugins/org.eclipse.osgi_3.8.1.dist.jar
osgi.bundles=reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.301.dist.jar#1\:start
org.eclipse.equinox.simpleconfigurator.configUrl=file\:org.eclipse.equinox.simpleconfigurator/bundles.info
As for the first two lines, I have files
$ locate eclipse.osgi_
/usr/share/java/org.eclipse.osgi_3.8.1.dist.jar
$ locate simpleconfigurator_1
/usr/lib/eclipse/plugins/org.eclipse.equinox.simpleconfigurator_1.0.301.dist.jar
Nevertheless:
/usr/share/java/org.eclipse.osgi_3.8.1.dist.jar seems to belong to no package (a remnant of some old package?), since
$ apt-file search /usr/share/java/org.eclipse.osgi_3.8.1.dist.jar
gives no results.
I have ver 3.9.1
$ dpkg -l | grep libequinox-osgi-java
ii libequinox-osgi-java 3.9.1-1 all Equinox OSGi framework
$ dpkg -L libequinox-osgi-java
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libequinox-osgi-java
/usr/share/doc/libequinox-osgi-java/changelog.Debian.gz
/usr/share/doc/libequinox-osgi-java/copyright
/usr/share/java
/usr/share/java/org.eclipse.osgi-3.9.1.jar
/usr/share/maven-repo
/usr/share/maven-repo/org
/usr/share/maven-repo/org/eclipse
/usr/share/maven-repo/org/eclipse/osgi
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/3.9.1
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/3.9.1/org.eclipse.osgi-3.9.1.pom
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/debian
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/debian/org.eclipse.osgi-debian.pom
/usr/share/java/org.eclipse.osgi.jar
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/3.9.1/org.eclipse.osgi-3.9.1.jar
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/debian/org.eclipse.osgi-debian.jar
So I do not know if the problem is here.
How can I solve this?
Could not find an answer here
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=891956
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=898086
https://bugs.launchpad.net/ubuntu/+source/eclipse/+bug/1754886
https://ubuntu.pkgs.org/16.04/ubuntu-universe-i386/libequinox-osgi-java_3.8.1-8_all.deb.html
https://askubuntu.com/questions/1031171/eclipse-doesnt-start-on-ubuntu-18-04

You are probably using an older Eclipse version that does not work with Java 9 or higher:
If using Java 9 or newer please use Eclipse 4.7.1a or newer as it contains fixes in Eclipse launcher to add all JVM modules.
Do one of the following to solve the problem:
Use Java 8 to run Eclipse (a JRE/JDK can be put in the subfolder jre of your Eclipse installation or be specified in the eclipse.ini file)
Upgrade Eclipse (recommended).

Related

SBT fails with `String.class is broken`

sbt fails with a cryptic error on issuing any command (compile, assembly, clean or any other).
$ sbt --version
error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken
(class java.lang.NullPointerException/null)
I am on a machine running macOS, and sbt was installed via homebrew. I have tried upgrading to the latest versions of sbt (1.3.10), but the error still persists.
The issue is documented on the SBT Download page.
Homebrew maintainers have added a dependency to JDK 13 because they want to use more brew dependencies (brew#50649). This causes sbt to use JDK 13 even when java available on PATH is JDK 8 or 11. To prevent sbt from running on JDK 13, install jEnv or switch to using SDKMAN.
I was able to resolve the problem by using JDK 8 via jEnv.
Since sbt documents JDK 8 and 11 as compatible versions
We recommend AdoptOpenJDK JDK 8 or AdoptOpenJDK JDK 11
try controlling which JDK is used by sbt via -java-home setting which can be configured system-wide via sbtopts run configuration
/usr/local/etc/sbtopts
or per-project basis via
<project-root>/.sbtopts
For example, to configure JDK used by sbt in current project, try setting in .sbtopts
-java-home /Users/picard/.sdkman/candidates/java/current
This is what solved my problem on my Mac.
brew uninstall sbt
Install sdkman
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
Install sbt via sdk
sdk install sbt
I had the same issue recently. What worked for me is to install SDKMAN(https://sdkman.io/)
$ curl -s "https://get.sdkman.io" | bash
...
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
...
After installation, I wanted to see what versions of Java I can install. So I simply run this command to list all the available versions of Java
sdk list java
Choose the version you want to install (recommend installing either 8 or 11 as mentioned above) and simply run the command with the identifier that specifies your version from the list
sdk install java 11.0.3.hs-adpt
After installation, it set the Java 11 to default on my system. I then ran the sbt command again and it worked.
If you are using SDKMAN then in some cases certain versions of Java (i.e. JDK) from different vendor might help.
E.g. I was using Amazon Correto JDK8 (version 8.332.08.1-amzn) and it could not properly build my sbt project in IntellIJ IDEA, so I've switched to using Zulu's JDK8 (version 8.0.332-zulu) as default java version.
Hope this helps and good luck. :)

The JDK is missing and is required to run some NetBeans modules

Complete error message:
The JDK is missing and is required to run some NetBeans modules
Please use the --jdkhome command line option to specify a JDK installation or see http://wiki.netbeans.org/FaqRunningOnJre for more information.
Some details: I just installed Netbeans on Linux mint for the first time and when I start it when its turning on modules this error message appears. But I do have jdk installed.
$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
$ javac -version
javac 1.8.0_66
Find the file [netbeans installation directory]/etc/netbeans.conf
Luckily, Linux has a find helper like
find /home/ -name "netbeans.conf,
in which you can change the /home/ to a location where you want to search.
I found it at /usr/local/netbeans-8.1/etc/netbeans.conf
Once, you found the file, the following property needs to be set:
netbeans_jdkhome="[jdk_path]"
where you can find the jdk_path using:
update-alternatives --config java
In my case, I found it at /opt/java/jdk1.8.0_191
[Solved] For Mac OSX 10.11 (El Capitan).
Solution may be similar for other Unix-based systems.
The problem may have occurred because I inadvertently installed the jre
prior to installing the jdk. I uninstalled the jre, installed the jdk
and reinstalled NetBeans but the problem (popup window) remained.
However, the fix was fairly simple.
1. Make sure NetBeans is not running.
2. Make sure the jdk is installed.
3. Determine the location of the jdk:
The jdk location can be determined by entering the following (in Terminal):
$ /usr/libexec/java_home
For my system, the output was:
/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
4. Edit the NetBeans configuration file to indicate the location of the jdk.
Near the bottom of this Netbeans configuration file (or equivalent for your NetBeans version):
/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
Comment out the following line (insert a # before the first character):
#netbeans_jdkhome="/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/bin/jre"
Then, add the following line (or equivalent for your jdk version):
netbeans_jkdhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home"
Then, save and exit the editor.
5. Start NetBeans (no more popup window indicating that the jdk is missing).
When netbeans has problems trying to find the path of the jdk, it's mainly because the version of the jdk does not match. Open the file C:\Program Files\NetBeans 8.2\etc\netbeans.conf, and verify that netbeans_jdkhome = "C:\Program Files\Java\jdk1.8.0_111".
Open netbeans.conf
sudo nano "/usr/lib/jvm/java-8-oracle/netbeans.conf"
Set proper sdk path:
netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"
Exit Ctrl + X and to save changes Ctrl + T
This error showed up when I updated the Mac to Mojave. To fix, I edited the netbeans.conf file with the current jdk by using Terminal to find the correct jdk. Type
/usr/libexec/java_home -V
Here was my output.
Matching Java Virtual Machines (4):
1.8.311.11 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_131 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
1.8.0_25 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
1.7.0_79 (x86_64) "Oracle Corporation" - "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
Entering the first jdk listed did not work.
I edited the conf file with the second one listed:
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home"
Restarted Netbeans. That fixed it.
This worked for me
1. install full JDK
2. either edit <netbeans-IDE-installation>/etc/netbeans.conf
2.1 unmark netbeans_jdkhome
2.2 link to JDK location e.g. /usr/local/share/java/jdk1.6.0_07/
3. or use --jdkhome command-line option e.g. ./bin/netbeans --jdkhome /usr/local/share/java/jdk1.6.0_07/
take care with the "/" at the end
More info in http://wiki.netbeans.org/FaqRunningOnJre
Ubuntu 16.04 LTS:
Uninstall the netbeans you have.
Delete .cache/netbeans folder
Download http://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-142931.html
Install your download
I have this problem to. But now i resolove this problem with edit one line.
Find and open this file /etc/netbeans.conf
If you see netbeans_jdkhome="C:\Program Files\Java\jre1.8.0_151" replace netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_131"
Save as adminstrator
Problem reseloved
In mid April 2019, Oracle has changed the JDK's licence. However, I was still able to solve this issue with NetBeans 11 and the JDK 12's open source build on my Windows machine. Just downloaded the open source JDK from https://jdk.java.net/ and extracted it. Then, in my NetBeans config file, I typed in the path to the extracted directory (NOT the "bin" folder!).
I resolved this problem by changing default version of JRE and JDK that I'm using to 11.x.x with following commands:
sudo update-alternatives --config java
sudo update-alternatives --config javac

Eclipse 4.4 on Ubuntu 14.04 - "no such file" error

I am working on Ubuntu 14.04 LTS and I would like to install eclipse 4.4. I did everything step by step with this site:
http://tutorialforlinux.com/2014/03/13/how-to-install-eclipse-4-3-kepler-standard-on-ubuntu-12-04-precise-lts-3264bit-linux-easy-visual-guide/
Now it is what I got after step 6 when I try to start eclipse:
zaba#zaba:~$ ls /opt/eclipse/
about_files configuration eclipse.ini icon.xpm
plugins about.html dropins
epl-v10.html notice.html readme artifacts.xml
eclipse features p2
zaba#zaba:~$ ls /usr/local/bin/
eclipse
zaba#zaba:~$ eclipse
bash: /usr/local/bin/eclipse: no such file or directory
zaba#zaba:~$
As you can see teoretically everything is on its place: 'eclipse' file in /opt/eclipse and its link in /usr/local/bin - I made it as in tutorial, by:
ln -s /opt/eclipse/eclipse /usr/local/bin/eclipse
But it does not work. Can anyone help, please?
since "A third-party application in /opt is supposed to be self-contained"
it should run through
/opt/eclipse/eclipse
if it does not, there is a problem either with your user or the executable, try just copying it to ~/bin
You might have a mismatch on 64-bit and 32-bit in your operating system and eclipse version.

Can't install jdk on Fedora with yum nor with rpm

Help! I can't figure out how to install a jdk!
[/usr/lib/jvm]$ su -c "yum install java-1.7.0-openjdk-devel"
Loaded plugins: langpacks, presto, refresh-packagekit
No package java-1.7.0-openjdk-devel available.
Error: Nothing to do
[/usr/lib/jvm]$ su -c "yum install java-1.7.0-openjdk"
Loaded plugins: langpacks, presto, refresh-packagekit
No package java-1.7.0-openjdk available.
Error: Nothing to do
[/usr/lib/jvm]$ su -c "yum install java-1.6.0-openjdk-devel"
Loaded plugins: langpacks, presto, refresh-packagekit
No package java-1.6.0-openjdk-devel available.
Error: Nothing to do
[/usr/lib/jvm]$ su -c "yum install java-1.6.0-openjdk"
Loaded plugins: langpacks, presto, refresh-packagekit
No package java-1.6.0-openjdk available.
Error: Nothing to do
Here I've manually downloaded some rpm's, the last one from oracle's website:
[~]$ rpm -ivh java-1.7.0-openjdk-devel-1.7.0.19-2.3.9.3.fc20.x86_64.rpm
error: Failed dependencies:
java-1.7.0-openjdk = 1:1.7.0.19-2.3.9.3.fc20 is needed by java-1.7.0-openjdk-devel-1:1.7.0.19-2.3.9.3.fc20.x86_64
[~]$ sudo rpm -ivh java-1.7.0-openjdk-1.7.0.19-2.3.9.3.fc20.x86_64.rpm
Preparing... ################################# [100%]
file /usr/lib/jvm-exports/jre-1.7.0-openjdk.x86_64 from install of java-1.7.0-openjdk-1:1.7.0.19-2.3.9.3.fc20.x86_64 conflicts with file from package java-1.7.0-openjdk-1:1.7.0.9-2.3.7.0.fc18.x86_64
file /usr/lib/jvm/jre-1.7.0-openjdk.x86_64 from install of java-1.7.0-openjdk-1:1.7.0.19-2.3.9.3.fc20.x86_64 conflicts with file from package java-1.7.0-openjdk-1:1.7.0.9-2.3.7.0.fc18.x86_64
[~]$ sudo rpm -ivh jdk-7u21-linux-x64.rpm
Preparing... ################################# [100%]
file /etc/init.d/jexec from install of jdk-2000:1.7.0_21-fcs.x86_64 conflicts with file from package jdk-2000:1.6.0_38-fcs.x86_64
Debug
Here's some debug information:
[/usr/lib/jvm]$ yum search jdk
Loaded plugins: langpacks, presto, refresh-packagekit
=========================================================== N/S Matched: jdk ============================================================
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
jdk.x86_64 : Java(TM) Platform Standard Edition Development Kit
ldapjdk.noarch : The Mozilla LDAP Java SDK
Name and summary matches only, use "search all" for everything.
.
[/usr/lib/jvm]$ yum list java*
Loaded plugins: langpacks, presto, refresh-packagekit
Installed Packages
java-1.5.0-gcj.x86_64
.
[/usr/lib/jvm]$ cat /etc/fedora-release
Fedora release 18 (Spherical Cow)
Requirements
I must have "jni.h", "libjava.so", "libhpi.so", "lipverify.so" and "libjvm.so" included.
So far I've found out that these DO NOT have what I need:
Undesired Versions (for sure):
jdk1.7.0_06 <-- I'm surprised about this one, but it doesn't have libjvm nor libhpi
java-1.7.0
java-openjdk
java-1.7.0-openjdk-1.7.0.9.x86_64
java-1.5.0-gcj-4.4
java-1.6.0-openjdk
java-1.7.0-openjdk.x86_64
jre-1.5.0-gcj
jre-1.7.0-openjdk.x86_64
jre-openjdk
jre-1.7.0
jre-7u11-linux-x64.rpm java-1.5.0-gcj-1.5.0.0
jre-1.5.0
jre1.7.0_11
jre-gcj
And these do:
Desired Versions (that I know of, there could be more):
jdk1.6.0_34-x86
jdk1.5.0_22-x86
java-6-openjdk
Can someone help me install jdk1.6 or java-6-openjdk please?
The problem here is that you cannot use the Oracle rpm to install JDK 7 when you already have the Oracle JDK 6 as it tries to install the /etc/init.d/jexec script which is already installed and required for JDK 6.
I would advise sticking to the tarball or self extracting *.bin and using JAVA_HOME if you are going to use the Oracle distribution as it does not have this problem and you will probably not need jexec anyway.
In general I would suggest that you install the Oracle JDK not the OpenJDK. Otherwise you might risk running into some issues. I always found problems of all sorts and sizes with OpenJDK that I don't even bother trying it any more.
Download the JDK RPM from here and follow the usual instructions. Its usually very straightforward and without problems.
Full detailed instructions including how to install it here.
Make sure you choose the right version you need (JDK 1.7 or JDK 1.6, dont mix) because from your question you seem to have a confusion of library versions from 1.5 to 1.7.
And another thing, uninstall whatever you have installed already before installing a fresh one to avoid conflicts.
Check my answer here Transaction check error when installing Sun JDK 7
Basically you may use rpm --force to install one JDK on top of the other. This scenario is completely valid specially when you have to develop for different JAVA versions.
Just faced the same issue. I was not comfortable using --force command; did not want to risk messing-up the existing Java that came installed at system setup.
I ended up doing the following and running the app server with a different version of Java under a different user ID.
downloaded the Java tar.gz version and uncompressed:
tar -zxvf jdk-7u45-linux-x64.gz
Created the directory:
mkdir /usr/java/jdk1.7.0_45
Copied the contents to the new directory manually:
cp -r /.../jdk1.7.0_45/* /usr/java/jdk1.7.0_45
Set the java_home under the user ID home directory in .bashrc and .bash_profile files:
export JAVA_HOME=/usr/java/jdk1.7.0_45
export PATH=$JAVA_HOME/bin:$PATH
export PATH=$PATH:/usr/sfw/lib/gcc:/usr/sfw/bin
sudo rpm -i jdk-11.0.9_linux-x64_bin.rpm
or whatever package you are trying to install

Colorer Plugin in Eclipse Helios

I've been unable to get the wonderful Eclipse Colorer plugin to work with my current copy of Eclipse (Helios 64 bit). It installs ok but whenever I attempt to open a source file I get this error:
Error in initialization of native part of the Colorer library. This can be caused by absent net_sf_colorer.dll (libnet_sf_colorer.so) library in paths of java machine. Or, colorer can't find catalog.xml file, which must be placed in '%PLUGIN_DIR%'/colorer/catalog.xml'
Could not initialize class net.sf.colorer.ParserFactory
It has nothing to do with the version of Eclipse. Try a 32-bit Version, AFAIK Eclipse Colorer has no support for 64-bit.
I actually managed to make it run on a 64bit eclipse (indigo) by compiling my own version of Colorer. Once you know it's pretty easy: first you get the svn version:
svn co https://colorer.svn.sourceforge.net/svnroot/colorer/trunk/ trunk
cd trunk/eclipsecolorer/libnative
mkdir objs # not sure why make cannot do that..
make -f makefile.macos_64
Then you must create a new x86_64 directory in your eclipse plugin, and copy the lib there. In my case it was:
mkdir /Applications/eclipse/plugins/net.sf.colorer_0.9.8/os/macosx/x86_64
cp libnet_sf_colorer.jnilib /Applications/eclipse/plugins/net.sf.colorer_0.9.8/os/macosx/x86_64/