How do I install Java JNA in Ubuntu server 14? - java

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

Related

JavaFX on Oracle Linux 8.6

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.

How To Configure and Download Java JDK in ubuntu for VS code

I've tried to run vscode in java but the vs code is showing an error of (Not Pointing To JDK).
Is there is any way to run java programs in vs code in ubuntu.
Install java from here Install java from here Install java from here Install java from here Install java from here
https://code.visualstudio.com/docs/java/java-debugging#:~:text=You%20can%20manually%20install%20the,Code%20for%20the%20first%20time.
The simplest way is to run:
sudo apt-get install openjdk- and to press TAB several times for available options.
You will then choose a specific jdk.
Some examples:
sudo apt-get install openjdk-14-jdk
sudo apt-get install openjdk-13-jdk
sudo apt-get install openjdk-11-jdk
Afterwards you can restart VSCode.

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

Getting ERROR: Cannot start PyCharm No JDK found

I am trying to use PyCharm 4.0.3 (community version) with Red Hat 6.3. I downloaded Linux version from PyCharm website and extracted it on my Linux machine. When I ran PyCharm it initially gave me below error
ERROR: Cannot start PyCharm
No JDK found. Please validate either PYCHARM_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.
Then I added below two lines in my ~/.cshrc (I am using tcsh)
setenv JAVA_HOME /tools/jre1.6.0
setenv PATH ${PATH}:${JAVA_HOME}/bin
I verified that Java location is correct but now when I run PyCharm it doesn't do anything and I get the control back on command prompt.
For running PyCharm you need to install Oracle Java. Install Oracle Java with the following commands.
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
After successful execution of above commands you can run pycharm.sh file in the bin folder.
I also had the same problem
To solve this problem
First you need to install java jdk 1.8
Below link java sdk 32 bit version
http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-i586.tar.gz
For 64 bit
http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz

Error While installing netbeans in ubuntu 12.04

I tried to install netbeans 'netbeans-7.2.1-ml-linux.sh' on my ubuntu12.04
But when i am executing this .sh file i am gettig the exception given below.
Configuring the installer...
Searching for JVM on the system...
Extracting installation data...
Running the installer wizard...
Can`t initialize UI
Running in headless mode
Exception: java.awt.HeadlessException thrown from the UncaughtExceptionHandler in thread "main"
You need to install Java Runtime Environment
sudo aptitude install default-jre
Refer to this answer:
netbeans installation error: can't initialize ui running in headless mode
Worked for me. For some reason, with OpenJDK the installer was unable to open a GUI.
The Problem is the support of openJDK for the UI.
The solution is installing Oracle JDK, open your terminal and write the following commands:
sudo apt-get remove openjdk*
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
after that reinstall netbeans.
You're missing a X-Server for installation (java.awt.HeadlessException). The installation script needs a UI.
For some reason the sh installer does not work with the openJDK 7.
Quick fix to install is to change back to JDK 6.
run:
sudo update-alternatives --config java
(select java 6)
sh netbeans-7.2.1-ml-linux.sh
the installer should run and then just switch back to the java 7 JDK with update-alternatives.
In my case, I had openjdk installed, where /usr/bin/java was point to the installed openjdk.
I solved it by installing the Oracle JDK 7, from a tar.gz file. Extract the tar ball to a location say your $HOME directory.
After that
I modified the .bashrc file and modified the PATH variable to
PATH=$HOME/jdk1.7/bin/:$PATH export PATH
Remember the path to your jdk/bin should be appended to PATH, as as result the system will find the java executable in your path rather than picking the installed openjdk.
Note: I chose not to uninstall installed openjdk, as most of my Libreoffice and other installed applications were depending on it.
First you have to update
sudo apt-get update
Then default java
sudo apt-get install -f default-jre
sudo apt-get install -f default-jdk
And should be done.
This is what fixed it for me:
I installed the Java JDK. In this case:
sudo aptitude install openjdk-8-jdk
Here's the kicker: I made sure that my Home and Path variables were set properly. Again, in my case:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
export PATH=$PATH:/usr/lib/jvm/java-8-openjdk/bin
My initial issue was not having the JDK installed. It was then not having the environment variables properly set. If they aren't properly set, the installer won't launch. Simple as that.

Categories

Resources