I am trying to run a simple program on NetBeans in Ubuntu 18.04:
package testing1;
public class Testing1 {
public static void main(String[] args) {
// TODO code application logic here
System.out.println("Zulfi");
}
}
The version details of Netbeans are:
[quote]Product Version: Apache NetBeans IDE 10.0 (Build 20190203-debian-10.0) Java: 11.0.10; OpenJDK 64-Bit Server VM 11.0.10+9-Ubuntu-0ubuntu1.18.04 Runtime: OpenJDK Runtime Environment 11.0.10+9-Ubuntu-0ubuntu1.18.04 System: Linux version 4.15.0-135-generic running on amd64; UTF-8; en_US (nb) User directory: /home/zulfi/.netbeans/10.0 Cache directory: /home/zulfi/.cache/netbeans/10.0[/quote]
I am getting classpath problem,
"Cant access java.lang Unable to find package java.lang in classath
I already have java installed on my system. I installed java before installing Netbeans. I checked the version of java and javac commands:
$ java -version
openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.18.04) OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.18.04, mixed mode, sharing) @lc2530hz:~$ javac -version javac 11.0.10
Now I found the location where java is stored: i.e. /usr/lib/jvm It contains:
@lc2530hz:/usr/lib$ ls jvm
default-java java-11-openjdk-amd64
java-8-openjdk-amd64 java-1.11.0-openjdk-amd64 java-1.8.0-openjdk-amd64 openjdk-11
Now the NetBeans product version says:
Java: 11.0.10; OpenJDK 64-Bit Server VM 11.0.10+9-Ubuntu-0ubuntu1.18.04
I checked openjdk-11 folder:
/usr/lib/jvm/openjdk-11$ ls src.zip zulfi@lc2530hz:/usr/lib/jvm/openjdk-11$
I don't remember if I unzipped the above folder
Then I checked /usr/lib/jvm/java-11-openjdk-amd64 folder:
$ ls /usr/lib/jvm/java-11-openjdk-amd64
bin conf docs include jmods legal lib man release
So I decided to use /usr/lib/jvm/java-11-openjdk-amd64 as the path for JAVA_HOME
$ echo $JAVA_HOME /usr/bin/java @lc2530hz:/usr/lib/jvm/java-11-openjdk-amd64$ export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 @lc2530hz:/usr/lib/jvm/java-11-openjdk-amd64$ echo $JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64 @lc2530hz:/usr/lib/jvm/java-11-openjdk-amd64$ netbeans
But still I am getting the same error.
I am running Netbeans for the first time on ubuntu 18.04 so I am getting java.lang problem. Netbeans is not able to recognize the "String" class.
Somebody please guide me. Zulfi.
sudo apt install netbeans
.