1

When I set name and location of a new Java project it stops and show a message of error :

A java.lang.NoClassDefFoundError exception has occurred

So the project isn't created and I can write any code lines on Netbeans.

My OS version

  • Ubuntu 14.04.2 LTS 64 bit

My NetBeans version

  • Product Version: NetBeans IDE 7.0.1 (Build 20121011-unknown-revn)
  • Java: 1.7.0_75; OpenJDK 64-Bit Server VM 24.75-b04
  • System: Linux version 3.13.0-49-generic running on amd64; UTF-8; it_IT (nb)
  • Userdir: /home/ema/.netbeans/7.0
A.B.
  • 90,397

1 Answers1

0

You need to set up CLASSPATH in /etc/environment. Execute the following command in a terminal (Ctrl+Alt+T)

 sudo gedit /etc/environment

Add the following lines (all four lines at the end of /etc/environment)

JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/bin"
export JAVA_HOME
CLASSPATH="/usr/lib/jvm/java-7-openjdk-amd64/lib"
export CLASSPATH

Then restart your system.

  • In the terminal after i run the first line( sudo gedit /etc/environment ) and add this JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/bin" I see this message: (gedit:3222): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files – cinnamicacid Apr 13 '15 at 18:46
  • No problem, just save the file and restart system. It should work now. Ignore these messages – Faizan Akram Dar Apr 13 '15 at 18:48
  • nothing changes and when I run the export command in the terminal nothing happens – cinnamicacid Apr 13 '15 at 19:03
  • @EmaJ You dont have to run export command in terminal rather you have to add all these four lines to /etc/environment also add these lines to ~/.bashrc . Execute gedit ~/.bashrc in terminal and add these four lines to it and save it. – Faizan Akram Dar Apr 13 '15 at 19:10
  • I've run the commands and added the lines but can created any project on netbeans. – cinnamicacid Apr 13 '15 at 19:19
  • Does netbeans still throws the same error, even after restarting system? – Faizan Akram Dar Apr 13 '15 at 19:23
  • Yes it does it always shows the same exception – cinnamicacid Apr 13 '15 at 19:27
  • Then it is probably a bug, you may file it at https://bugs.launchpad.net/ And you may use eclipse alternatively – Faizan Akram Dar Apr 13 '15 at 19:30