What does "The APR based Apache Tomcat Native library was not found" mean? - eclipse

I am using Tomcat 7 in Eclipse on Windows. When starting Tomcat, I am getting the following info message:
The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path
What does this mean and how can I provide the APR library?

It means exactly what it says: "The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path"
The library referred to is bundled into an OS specific dll (tcnative-1.dll) loaded via JNI. It allows tomcat to use OS functionalities not provided in the Java Runtime (such as sendfile, epoll, OpenSSL, system status, etc.). Tomcat will run just fine without it, but for some use cases, it will be faster with the native libraries.
If you really want it, download the tcnative-1.dll (or libtcnative.so for Linux) and put it in the bin folder, and add a system property to the launch configuration of the tomcat server in eclipse.
-Djava.library.path=c:\dev\tomcat\bin

Unless you're running a production server, don't worry about this message. This is a library which is used to improve performance (on production systems). From Apache Portable Runtime (APR) based Native library for Tomcat:
Tomcat can use the Apache Portable Runtime to provide superior
scalability, performance, and better integration with native server
technologies. The Apache Portable Runtime is a highly portable library
that is at the heart of Apache HTTP Server 2.x. APR has many uses,
including access to advanced IO functionality (such as sendfile, epoll
and OpenSSL), OS level functionality (random number generation, system
status, etc), and native process handling (shared memory, NT pipes and
Unix sockets).

On RHEL Linux just issue:
yum install tomcat-native.x86_64
/Note:depending on Your architecture 64bit or 32bit package may have different extension/
That is all. After that You will find in the log file next informational message:
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
All operations will be noticeably faster than before.

Installation the native library on Ubuntu server with:
sudo apt-get install libtcnative-1
If that does not work tomcat-native needs to be installed
Install Oracle java7:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default
Install tomcat apr:
wget http://apache.mirror.anlx.net//apr/apr-1.5.0.tar.gz
tar zxvf apr-1.5.0.tar.gz
rm apr-1.5.0.tar.gz
cd apr-1.5.0
sudo ./configure
sudo make
sudo make install
export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'
Install tomcat tomcat-native:
wget http://mirrors.ukfast.co.uk/sites/ftp.apache.org//tomcat/tomcat-connectors/native/1.1.29/source/tomcat-native-1.1.29-src.tar.gz
tar zxvf tomcat-native-1.1.29-src.tar.gz
rm tomcat-native-1.1.29-src.tar.gz
cd tomcat-native-1.1.29-src/jni/native
JAVA_HOME=/usr/lib/jvm/java-7-oracle
sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME
sudo make
sudo make install

I just went through this and configured it with the following:
Ubuntu 16.04
Tomcat 8.5.9
Apache2.4.25
APR 1.5.2
Tomcat-native 1.2.10
Java 8
These are the steps i used based on the older posts here:
Install package
sudo apt-get update
sudo apt-get install libtcnative-1
Verify these packages are installed
sudo apt-get install make
sudo apt-get install gcc
sudo apt-get install openssl
Install package
sudo apt-get install libssl-dev
Install and compile Apache APR
cd /opt/tomcat/bin
sudo wget http://apache.mirror.anlx.net//apr/apr-1.5.2.tar.gz
sudo tar -xzvf apr-1.5.2.tar.gz
cd apr-1.5.2
sudo ./configure
sudo make
sudo make install
verify installation
cd /usr/local/apr/lib/
ls
you should see the compiled file as
libapr-1.la
Download and install Tomcat Native source package
cd /opt/tomcat/bin
sudo wget https://archive.apache.org/dist/tomcat/tomcat-connectors/native/1.2.10/source/tomcat-native-1.2.10-src.tar.gz
sudo tar -xzvf tomcat-native-1.2.10-src.tar.gz
cd tomcat-native-1.2.10-src/native
verify JAVA_HOME
sudo pico ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
source ~/.bashrc
sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME
sudo make
sudo make install
Edit the /opt/tomcat/bin/setenv.sh file with following line:
sudo pico /opt/tomcat/bin/setenv.sh
export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'
restart tomcat
sudo service tomcat restart

On Mac OS X:
$ brew install tomcat-native
==> tomcat-native
In order for tomcat's APR lifecycle listener to find this library, you'll
need to add it to java.library.path. This can be done by adding this line
to $CATALINA_HOME/bin/setenv.sh
CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/opt/tomcat-native/lib"
If $CATALINA_HOME/bin/setenv.sh doesn't exist, create it and make it executable.
Then add it to the eclipse's tomcat arguments (double-click Server > Open Launch Configuration > Arguments tab > VM arguments)
-Djava.library.path=/usr/local/opt/tomcat-native/lib

on debian 8 I fix it with installing libapr1-dev:
apt-get install libtcnative-1 libapr1-dev

Had this problem as well. If you do have the libraries, but still have this error, it may be a configuration error. Your server.xml may be missing the following line:
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
(Alternatively, it may be commented out). This <Listener>, like other listeners is a child of the top-level <Server>.
Without the <Listener> line, there's no attempt to load the APR library, so LD_LIBRARY_PATH and -Djava.library.path= settings are ignored.

I had this issue upgrading from Java 8 to 11. After adding this dependency, my app launched without issue:
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.25.0-GA</version>
</dependency>

I had the same problem when tomсat could not find the class. Try to view other log files. Sometimes No class def found error appears in different log files:
tomcat8-stdout
tomcat8-stderr
localhost

If you don't have Tomcat Native library install it with:
sudo apt-get install libtcnative-1
and if it's still there an old version upgrade it with:
sudo apt-get upgrade libtcnative-1

My problem was in add some library from tomcat to eclipse class path i just going to
eclipse click right to project and going to debug configuration -> classpath -> Add External JARs add all jars files from apache-tomcat-7.0.35\bin this was my problem and it's worked for me .

For future readers:
I had faced this issue myself when trying to run a Spring Boot application in Spring STS. This issue didn't resurface initially. I was able to work on my project without any issues for quite some time until one fine day I started getting this particular error.
From what I am able to recall I had not made any configuration changes to my project and neither changed the Java/Tomcat version being used.
None of the discussions/suggestions regarding installing the tomcat native library made any sense to me since the project was already working fine before.
SOLUTION that worked for me:
So lastly I though of trying to delete and reimport my project.
I deleted my project from Spring STS, restarted the Spring STS and then reimported the project. It worked like a charm and never faced the issue ever since.
You may also try deleting any IDE generated files/folders(if there are any) in your project, before restarting the IDE and reimporting the project.
I still happen to work on this project from time to time and haven't faced the issue as of now. My current development IDE is IntelliJ.
I'm not sure if the error was IDE specific.

Related

E: Package 'oracle-java8-installer' has no installation candidate

I tried to install java8 using the following commands:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
I'm getting an error as follows :
Package oracle-java8-installer is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'oracle-java8-installer' has no installation candidate
when I searched the error, I found out that "WebUpd8" team has officially discontinued there support.
Please help to install oracle java 8. I'm using ubuntu 16.04.
I just went through the same process and I fixed the problem by manually installing java 8 on my ubuntu 18.04 machine. Hopefully my answer will help you.
Download the latest JAVA 8 SE development kit from here: https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
Open your terminal.
Type $mkdir /opt/jdk.
Untar Java in your new folder $tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk.
Set oracle JDK as the default JVM by running those two instructions (or something around that depending on your configuration):
Note: Each bullet point is one single command
update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_<YourVersion>/bin/java 100
update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_<YourVersion>/bin/javac 100
You can check the result by running java -version !
Before I started, I went through those steps as well in order to remove completely java from my system: https://askubuntu.com/questions/84483/how-to-completely-uninstall-java#185250
The source I used for the manual installation of JAVA was this article: https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps
Add the following line to /etc/apt/sources.list:
deb https://debian.opennms.org/ stable main
Install GPG key of the repository:
wget -O - http://debian.opennms.org/OPENNMS-GPG-KEY | sudo apt-key add -
Update the package index:
sudo apt-get update
Install oracle-java8-installer deb package:
sudo apt-get install oracle-java8-installer
Source
I was facing the same issue and resolved with this:\
sudo apt install openjdk-8-jdk
Please read the details when we execute the below command:
sudo add-apt-repository ppa:webupd8team/java
The Oracle JDK License has changed for releases starting April 16,
2019.
The new Oracle Technology Network License Agreement for Oracle Java SE
is substantially different from prior Oracle JDK licenses. The new
license permits certain uses, such as personal use and development
use, at no cost -- but other uses authorized under prior Oracle JDK
licenses may no longer be available. Please review the terms carefully
before downloading and using this product. An FAQ is available here:
https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html
Oracle Java downloads now require logging in to an Oracle account to
download Java updates, like the latest Oracle Java 8u211 / Java SE
8u212. Because of this I cannot update the PPA with the latest Java
(and the old links were broken by Oracle).
For this reason, THIS PPA IS DISCONTINUED (unless I find some way around this limitation).
This PPA works (Ubuntu 16.04)
sudo add-apt-repository ppa:ts.sch.gr/ppa
sudo apt-get update
sudo apt-get install oracle-java8-installer

Setting up Mesos on CentOS

I tried to install the latest release tarball of Mesos on CentOS 6.4 with no luck. It ended up in all sorts of failures in trying to find jvm & jni bindings. Is there any instructions on how to install Mesos on RHEL or CentOS ?
I couldn't find any instructions around so I thought I would troubleshoot all through my way and thought of documenting it here so it can save your time.
First things first, load your CentOS box with essential build tools to get started
$ sudo yum groupinstall "Development tools"
Get Java and python dependencies installed
$ sudo yum install java-1.6.0-openjdk.x86_64 java-1.6.0-openjdk-devel.x86_64 python python-devel libcurl libcurl-devel
Get the latest Mesos tarball
$ wget http://mirror.nus.edu.sg/apache/mesos/0.13.0/mesos-0.13.0.tar.gz
$ tar -xzvf mesos-0.13.0.tar.gz
$ cd mesos-0.13.0
Before you can build Mesos, you need to set correct JAVA binding paths
$ export JAVA_HOME=/usr
$ export JAVA_LDFLAGS="-L/usr/lib/jvm/java-1.6.0/jre/lib/amd64/server -R/usr/lib/jvm/java-1.6.0/jre/lib/amd64/server -ljvm"
$ export JAVA_CPPFLAGS="-I/usr/lib/jvm/java-1.6.0/include -I/usr/lib/jvm/java-1.6.0/include/linux"
$ export LD_LIBRARY_PATH=/usr/lib/jvm/java-1.6.0/jre/lib/amd64/server:$LD_LIBRARY_PATH
Configure and build it
$ ./configure
$ make
After you have built Mesos, it is advisable that you build and run the tests, this will make sure that what you have installed meets all the requirements
$ make check
If the checks are successful, You are just one step away from installing it in your system installation paths
$ make install
To learn how to use Mesos , go here http://mesos.apache.org/gettingstarted/
For those who prefer installing from RPM's, here is a link to a number of different releases for different Linux flavors: http://mesosphere.io/downloads/ For example, for Centos64:
wget http://downloads.mesosphere.io/master/centos/6/mesos_0.14.2_x86_64.rpm
sudo rpm -Uvh mesos_0.14.2_x86_64.rpm
I also had to set my LD_LIBRARY_PATH, though to a slightly different value. Check yours.
Python bindings can also be downloaded from the first link above:
wget http://downloads.mesosphere.io/master/centos/6/mesos_0.14.2_x86_64.egg
sudo easy_install mesos_0.14.2_x86_64.egg

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

How to install Oracle JDK 7 and Netbeans IDE in Linaro 13.01 ubuntu tty1?

I have a Processor A13(cpu: cortex-A8 ARM v7) of allwinner and my OS is Linaro 13.01 Ubuntu tty1.
So how do I install Oracle JDK7 and Netbeans IDE on that?
If you're using Ubuntu, there are several ways to install NetBeans. One way is to use Ubuntu's "Software Centre" which you can use just to search to NetBeans and it should install it including all dependencies.
You can also use your web browser in Ubuntu and head to www.netbeans.org and click "Download" at the top right, there you can choose your operating system and download the correct version of NetBeans.
Once downloaded you can run the NetBeans installer through terminal using: sh ./<NetBeans file name here>. And the installer will start.
To install Open JDK:
However, you may need to download and install the JDK first; which you can also do in terminal by typing: sudo apt-get install openjdk-7-jdk.
To install Oracle JDK:
This is taken from this link: http://www.wikihow.com/Install-Oracle-Java-JDK-on-Ubuntu-Linux
Remove open JDK from your system: sudo apt-get purge openjdk-\*
Create a new directory for the oracle JDK: sudo mkdir -p /usr/local/java
Download the Oracle Java JDK for linux by clicking here
Copy the Oracle Java binaries to the /usr/local/java directory: cd /home/userName/Downloads, sudo -s cp -r jfk-7u13-linux-x64.tar.gz /usr/local/java, cd /usr/local/java.
Extract the file: sudo -s tar xvzf jdk-7u13-linux-x64.tar.gz
Edit the system path file: sudo nano /etc/profile
Scroll to the bottom of the file and add this:
JAVA_HOME=/usr/local/java/jdk1.7.0_13
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
Save the file and exit (Ctrl+X), then enter "y" for nano.
Let Ubuntu know where the Oracle Java JDK is:
LOCN="/usr/local/jdk7"
sudo update-alternatives --install "/usr/bin/java" "java" "${LOCN}/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "${LOCN}/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "${LOCN}/bin/javaws" 1
Make sure Ubuntu knows to use this as the default JDK:
sudo update-alternatives --set java ${LOCN}/bin/java
sudo update-alternatives --set javac ${LOCN}/bin/javac
sudo update-alternatives --set javaws ${LOCN}/bin/javaws
Reload system path: /etc/profile, or just restart.
If you have trouble following my instructions then take a look at the link I posted above.
I would recommend using Open JDK instead though, as you can see; it's much easier to install.
I hope this helps.
Install Oracle JDK for ARM processor and Hard Float OS Image is here.
Oracle JDK for ARM Processor
And download Netbeans IDE 7.0.1 for Linux and install it.
Not to spoil your fun, but the A13 is a very weak SOC for this task.
I wouldn't even try anything below dual Cortex A15 with 2GB RAM (The Samsung XE303).
Oracle now releases the standard JDK8 for ARM Linux hardfloat so it is possible to install it on Debian/Ubuntu fairly easily:
Get JDK8 from Oracle's webpage (currently early access)
Extract th tar.gz-d JDK8 ARM/LInux/hfloat into /usr/lib/jvm/jdk1.8.0
Use update-alternatives (first answer)
Run "java -version" to check the results
..voila
I learned from Digital Ocean Docs how to manually install Oracle JDK on a headless ubuntu.
With a bit of Googling, I found following script to be useful.
wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz

netbeans installation error: can't initialize ui running in headless mode

I'm trying to install NetBeans on Linux Mint, and I'm getting the following error every time I run the installation script:
Configuring the installer...
Searching for JVM on the system...
Extracting installation data...
Running the installer wizard...
Can`t initialize UI
Running in headless mode
What should I do to get it working?
In case anyone has this problem in the future, Netbeans doesn't like OpenJDK 6 but -- fortunately -- it works fine with OpenJDK 7 (as expected as for Java 7 OpenJDK is the reference implementation). Just make sure you remove any Java 6 packages before installation attempts. On Ubuntu and Mint one can do:
sudo apt-get purge ^openjdk-6-*
sudo apt-get install openjdk-7-jdk
It should work afterwards.
Looks like Netbeans does not work properly with Openjdk. This is what I did (in Linux Mint 12):
sudo apt-get remove openjdk*
sudo apt-get install sun-java6-jdk
Then you will be able to run the .sh installer as usual.
I hit this same issue on Kubuntu 12.04 LTS but needed Sun JDK 6 for a project I'm maintaining. I stumbled upon Martin Wimpress' OAB-Java script (by way of help.ubuntu.com) which creates and installs a local apt repository for Sun JDK 6. You can find the latest instructions on Martin's github site which run as follows:
cd ~/
wget https://github.com/flexiondotorg/oab-java6/raw/0.2.7/oab-java.sh \
-O oab-java.sh
chmod +x oab-java.sh
sudo ./oab-java.sh
If you want to see what this script is doing while it is running then execute the following from another shell:
tail -f ./oab-java.sh.log
Alternatively, you can clone the OAB-Java repo and kick of the script from within it:
git clone git://github.com/flexiondotorg/oab-java6.git
cd oab-java6
sudo ./oab-java.sh
Either way, once that is in place follow Jose's instructions to remove openjdk and install sun jdk:
sudo apt-get remove openjdk*
sudo apt-get install sun-java6-jdk
One final note, the script accepts a -7 argument which will create and install a local apt repository for Oracle JDK 7 should you want to go that route.
I was able to get it to work by getting into the target system using ssh -X, then making sure DISPLAY was exported. That handles the X server issues.
Change the priority of the Oracle Java executables:
export PATH=/usr/java/latest/bin:$PATH
Run the installer:
./netbeans-8.1-linux.sh
What worked for me was installing default java environment from the terminal:
sudo apt-get install default-jre
The installation was a success - under "user".
The installation failed - under "su" (under Red Hat equivalent of "sudo"). With
Can`t initialize UI
Running in headless mode
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
For me.