JavaFX on Oracle Linux 8.6 - java

I have a Java application which uses javaFX to process images (using the javafx.scene.image.Image and some related functionality, and instantiating an javafx/embed/swing/JFXPanel object to force JavaFX to initialise). I'm trying to run this application on an Oracle free server running Oracle Linux 8.6 with Oracle Java 1.8.0_351 (OpenJDK and Oracle Java 19 give errors relating to JavaFX not being present). I've compiled my application into a JAR (compiling for Java 1.8.0_301 using Oracle Java on Windows). However, on the server, this doesn't work; I get the exception java.lang.UnsupportedOperationException: Unable to open DISPLAY.
This question's answer suggests using xvfb:
Deploy JavaFX on Ubuntu server without display
I've tried this, but get a "GLX version 1.3 or higher is required" error instead.
Is there a solution for running JavaFX with Oracle Linux?
What I've tried:
I've tried with two different OSes available with Oracle free;
Oracle Linux 8.6
OpenJDK was installed with sudo dnf install java-1.8.0-openjdk-devel.x86_64.
Running the jar gives the NoClassDefFoundError error.
I couldn't work out how to install javafx with dnf on Oracle Linux.
I decided to give Oracle Java a go; OpenJDK was unlinked with sudo unlink /etc/alternatives/java.
The Oracle jdk 19 was downloaded and installed with sudo rpm -ivh jdk-19_linux-x64_bin.rpm. Running the jar (with java -jar MyJar.jar) still gives the same error.
I tried uninstalling that (with sudo dnf remove jdk-19) and openJDK (with sudo dnf remove java) and installing Oracle Java 1.8.0 from a .rpm file. I then get an java.lang.UnsupportedOperationException: Unable to open DISPLAY error.
Xvfb was installed using sudo dnf install xorg-x11-server-Xvfb. xdpyinfo was installed using sudo dnf install xdpyinfo.
Xvfb was started using export DISPLAY=:99 and sudo xdpyinfo -display $DISPLAY > /dev/null || Xvfb $DISPLAY -screen 0 1024x768x16 & (taken from here: https://unix.stackexchange.com/a/297882 )
When running the JAR, I then get the exception
ES2 Prism: Error - GLX extension is not supported
GLX version 1.3 or higher is required
java.lang.UnsupportedOperationException: Internal Error
Canonical Ubuntu 22.04 Minimal
OpenJDK was installed with sudo apt-get install openjdk-8-jdk.
Running the jar gives the NoClassDefFoundError error.
OpenJFX was installed with sudo apt-get install openjfx. Same error.
I tried running the JAR with --module-path argument pointing to /usr/share/openjfx/lib/; --module-path is an unrecognised option with Java 8.
I upgraded to the latest openjdk sudo apt-get install openjdk. After this I'm able to use --module-path.
I tried running the JAR with java --module-path /usr/share/openjfx/lib/ --add-modules javafx.controls,javafx.base,javafx.graphics,javafx.swing -jar MyJar.jar (I'm not sure which modules correspond to which packages...). This causes a java.lang.UnsupportedOperationException: Unable to open DISPLAY error.

Related

Could not create the Java Virtual Machine Error

I'm trying to run this command on my linux machine:
java -noverify -Xbootclasspath/p:burp-loader-keygen-2020_2.jar -jar burpsuite_pro_v2020.2.jar
and i keep getting these errors:
-Xbootclasspath/p is no longer a supported option.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I tried to install again these versions:
sudo apt update
sudo apt install default-jdk -y
sudo apt install default-jre -y
But i kept getting the same error over and over, any solution or help or suggestion?
You are running the Burp Suite JAR file the wrong way.
If this is an older version of Burp Suite, you must use Java 8 which still supports the -Xbootclasspath option. Note it is not sufficient to simply install Java 8. You need to make sure that java -version says it is Java 8, or use the full path to the Java 8 version of the java
command.
This won't work with Burp Suite 2020.4 or later.
Conversely, if you are using Burp Suite 2020.4 or later, then you need to use Java 9 or later, and you need to run like this:
java -jar -Xmx4g /path/to/burp.jar
Source:
Burp Suite Releases: Professional / Community 2020.4
Launching Burp Suite from the command line (as of the time of writing this answer).

Netbeans is not getting installed in my Mac, it says JDK not found, though JDK is installed in the same

Error: Failure while executing the commands mentioned below:-
/usr/bin/sudo -E -- env LOGNAME=ajaygautam USER=ajaygautam USERNAME=ajaygautam /usr/sbin/installer -pkg /usr/local/Caskroom/netbeans/8.2/NetBeans\ 8.2.pkg -target / exited with 1.
Here's the output:
installer: Error - NetBeans IDE cannot be installed. Java (JRE) found on your computer but JDK 8 or newer is required. Please download and install the latest update of JDK 8 from http://www.oracle.com/technetwork/java/javase/downloads/index.html and restart NetBeans installation.
Would someone in tracing out the issue above? I'm not able to install NetBeans 8.2 package in my Mac.
I got the same problem and could to fix it with brew.
firstly install java JDK https://www.oracle.com/java/technologies/javase-downloads.html then run this in your terminal:
brew install netbeans
it will install the latest version of netbeans.
Download OpenJDK from Archived OpenJDK GA Releases.
This will give you a file such as openjdk-9.0.4_osx-x64_bin.tar. Extract the tar file and copy it to the correct place in your machine.
tar -xf openjdk-9.0.4_osx-x64_bin.tar
sudo cp -r jdk-12.0.2.jdk /Library/Java/JavaVirtualMachines/
Now you can run the Netbeans installer.
i just install using brew
brew install netbeans
and now i can use the latest 12.4
The following steps are used to install NetBeans on MacOS:-
1) Download the Latest version
In order to install NetBeans on MacOS, we have to download the latest version of NetBeans by visiting its official website I.e. https://netbeans.org/downloads/
2) Mount the disk image file
The dmg file which is downloaded from the official website of NetBeans is to be mounted to an installer. This can be done with the following command:
$ hdiutil mount Downloads/netbeans-8.2-macosx.dmg
3) Install the file
The file is mounted to the volumes directory which contains a package file (.pkg) which is installable by using the installer command. The command needs superuser privileges for which, sudo is used.
$ sudo installer -pkg Volumes/ NetBeans\ 8.2/NetBeans\ 8.2.pkg -target /
The file will be installed to the target root which is mentioned while installing the file.
4) Unmount the file
After the completion of installation process, we need to unmount the installer. This can be done by using the option Unmount with hdiutil command.
$ hdiutil unmount /Volumes/NetBeans\ 8.2
Well, we have done with the installation process of NetBeans 8.2 on MacOS.
Actually, java_home is in
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home
but in my case, java_home was in the next location i.e
/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java_home
I deleted my java_home from /usr/libexec/java_home by root user
added new java_home in /usr/libexec by following command
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java_home /usr/libexec/.
For some reason, some Netbeans versions for Mac OS do not detect the JDK contained in JRE. For proper installation and running the application, you must have Java for Mac OS installed previously. https://www.java.com/es/download/
Install The Lates Version ONLY which is 12.1 as of now!
https://netbeans.apache.org/download/nb121/nb121.html

Java Developer Kit executable unable to be found

I'm trying to install mysql on my Mac using the command
sudo apt install mysql
and it said I needed to install JDK on it. So I installed JDK but am receiving an error saying:
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/apt" (-1)
I have updated my env path to
JAVA_HOME=/Library/Java/Home
But when I install JDK theres no java file anywhere in my library, even though when I check to see if I have installed it, it is successfully found. I've installed Homebrew but do not know what package to install after the initial installation, or if this is the problem.
Any help would be appreciated.
If you are using Mac it would be much easier to install Homebrew from https://brew.sh and then use $ brew install mysql
see this link for the apt and yum command usage

Cant run java program on raspberry Pi [duplicate]

This question already has an answer here:
JavaFx Ensemble on Raspberry pi
(1 answer)
Closed 7 years ago.
I have downloaded the latest OS for the pi from here http://downloads.raspberrypi.org/raspbian_latest
Then i have downloaded the latest Java JDK to run my JavaFX application from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html and selected the Hard Flat v6/v7 file.
I have transferred and unzipped the JavaJDK onto my Pi.
Now if i execute this command on my local machine, my application starts
Java -jar program_name.jar
But if i run the same command on the Pi, i get an error saying
Could not find or load main class application.Main
If i change the .jar file into a .zip, i can clearly see a directory called application, and file called Main.class
So why is my program working on my (windows 10) machine, whether i run it from eclipse or the command line, but not on the raspberry Pi?
To install the Java Runtime Environment (JRE) run the following command:
sudo apt-get install openjdk-7-jre
This installs the Java JRE (Java Runtime Environment) which will allow you to run applications written in Java.
To install the JDK run the command:
sudo apt-get install openjdk-7-jdk
This allows you to compile Java applications to bytecode.
If you want the Oracle Java VM, which is a lot faster (optimized for embedded arm CPUs) and is also a developer preview (applications maybe buggy or crash) until some time into the future. Instead of the above instructions you need to download the file called Oracle JDK 8 (with JavaFX) for ARM Early Access on the Oracle Java 8 download page.
Remember to download the Oracle Java system on your Pi, or you won't be able to install it.
To install the Oracle Java System:
sudo tar zxvf jdk-8-ea-b36e-linux-arm-hflt-*.tar.gz -C /opt
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.8.0/bin/java" 1
sudo update-alternatives for other commands if needed (e.g. javac).
java -version
Then it is all installed.
Another thing, if you have more then one Java runtime installed you have to check which version you use with the command java -version. If the output is:
java version 1.5.0 gij (GNU libgij)
Then you are using another java runtime. You can resolve the issue by running
sudo update-alternatives --config java
and choosing the OpenJDK or Oracle option.

How do I install Java JNA in Ubuntu server 14?

I'm trying to install the java native library from the command line as
sudo apt-get install libjna-java
but Ubuntu tells me
E: Unable to locate package libjna-java
and even if I do cache search, there is nothing there matching that package.
How do I install Java JNA in Ubuntu server 14?
libjna-java is in universe repository and it seems that you dont have it enabled.
To enable, run
sudo add-apt-repository universe

Categories

Resources