Q:

Netbeans 8.1 IDE exits unexpectedly on Ubuntu 17.04

I am using Ubuntu 17.04 as my OS. I want to install and use Netbeans as my php editor. So I have tried sudo apt install netbeans and Netbeans 8.1 is now installed on my system.
But as I try to open it, it gets closed just after trying to open. Even using sudo command (sudo netbeans) or not (as normal user).

I have tested to run app from terminal but no errors outputted (as can be seen in above image).
Update
The message.log that is asked in comment is this:

...
------------------------------------------------------------------------------- java.lang.SecurityException: setContextClassLoader    at
  java.base/jdk.internal.misc.InnocuousThread.setContextClassLoader(InnocuousThread.java:104)
    at org.netbeans.ModuleManager.updateContextClassLoaders(Unknown
  Source)   at org.netbeans.ModuleManager.(Unknown Source)    at
  org.netbeans.core.startup.ModuleSystem.(Unknown Source)     at
  org.netbeans.core.startup.Main.getModuleSystem(Unknown Source) INFO
  [null]: Last record repeated again.   at
  org.netbeans.core.startup.Main.start(Unknown Source)  at
  org.netbeans.core.startup.TopThreadGroup.run(Unknown Source)  at
  java.base/java.lang.Thread.run(Thread.java:844)

Screen Shot:

According to this bug report it seems that, this issue is fixed on netbeans 8.2 but by now it is not available. Any idea?

A:

You combo is not supported.
You are using Java 9 with NetBeans 8.1. That won't fly.
First of all:  Why use an old version of NetBeans. Why not use NetBeans 8.2?
Secondly: Using Java 9 as the runtime for executing NetBeans will not be supported until NetBeans 9.x is released.
Solution:  

Use Java 8, not Java 9. You can use a private copy of Java only for NetBeans, if you don't want to change you system's overall Java. This is done by setting netbeans_jdkhome variable in /usr/share/netbeans/8.x/etc/netbeans.conf file.
Use NetBeans 8.2  (just because it is always best to use the latest. NB 8.1 was released in Oct 2015, almost 2 years ago, while NB 8.2 was released last October).

If you still have problems after this then please post here.

