I have been following this tutorial, and at step 5, I am getting the following output from GCC:
HelloWorld.c:1:17: error: jni.h: No such file or directory
In file included from HelloWorld.c:3:
HelloWorld.h:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
HelloWorld.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
I know that he include directories vary from system to system, so I tried to adapt the command accordingly, but I cannot seem to find the correct directory on my system. I am using Ubuntu 10.04LTS.
Open up a terminal and type:
locate jni.h
That should tell you where every file called jni.h is on your system. I am on ubuntu 11.04, and it's located at:
/usr/lib/jvm/java-6-openjdk/include/jni.h
/usr/lib/jvm/java-6-sun-1.6.0.26/include/jni.h
You may also need to get it from the repos:
sudo apt-get install openjdk-6-jdk
should do the trick if you don't have it installed.
jni.h lives with JDK. For me it is: jdk1.6.0_25/include/.
And by default, I don't think Ubuntu would have JDK with development libraries, so download latest JDK version from Oracle and install it somewhere.
Or you can install openjdk as #Leif suggested if it works on 10.04 LTS. Although, I personally, prefer the one from Sun/Oracle.
In Ubuntu 14.04 run:
sudo apt-get install openjdk-7-jdk openjdk-7-jre-lib
Now, you have a headers into /usr/lib/jvm/java-7-openjdk-amd64/include
For OpenJDK 6:
sudo apt-get install openjdk-6-jdk openjdk-6-jre-lib
Related
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
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
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
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.
I am putting together a dev environment for a Java program and after the first try of my Ant build scripts I got this error:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar
While the path to the jdk is correct, the tools.jar really wasn't there. Is it actually supposed to be there or did I get some config/installation thing wrong?
It seems like you can have Java installed in /usr/lib/jvm/java-6-openjdk but only have the JRE, not the JDK. This fixed it for me:
sudo apt-get install openjdk-6-jdk
Note: On CentOS / RHEL installing java-1.x.0-openjdk will not be enough. Also install java-1.x.0-openjdk-devel.
It's there on my machine. I'm running Sun JDK 1.6.0_21 on Windows XP SP3.
Are you sure you have the JDK? Is it possible that you only have the JRE?
On Debian, after installing Ant with apt-get install ant, I've encountered the same error when running it:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk-amd64/lib/tools.jar
Indeed, there's no mention of any tools.jar anywhere in /usr/lib, although /usr/lib/jvm/java-6-openjdk-amd64 itself does exist.
https://packages.debian.org/search?searchon=contents&keywords=java-6-openjdk-amd64%2Flib%2Ftools.jar
As per the search above, java-6-openjdk-amd64/lib/tools.jar appears to be part of openjdk-6-jdk, which indeed didn't get installed with ant (since it's only marked as suggested (https://packages.debian.org/wheezy/ant)).
apt-get install openjdk-6-jdk
apt install defalut-jdk # this doesn't contain some file, like tools.jar...
apt install openjdk-8-jdk # this contains all files.
On Ubuntu I've just need to install JDK
sudo apt-get install openjdk-7-jdk
..and you can always search for all available versions with
$ sudo apt-cache search openjdk | grep ^openjdk
From the website https://openjdk.java.net/install/ we can read
The openjdk-7-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-7-jdk package.
Try the following:
% sudo apt-get install sun-java6-jdk
% sudo update-alternatives --config java
select the option that has the path
/usr/lib/jvm/java-6-sun/jre/bin/java
Worked for me on an ubuntu 10.4
u can try to put your JAVA_HOME also, as follows:
% sudo export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
Installing the jdk-6u45-linux-x64.bin (from the oracle.com site) via unzip does not result in a tools.jar. I guess that file is created by the "make-jpkg" script. Once I did that, and installed the resulting .deb file, everything was fine.
I really hate oracle's lawyers.
Even if you have jdk installed, you'll need to redirect JAVA_HOME to point to it.
Here's one weird trick you can put into your .profile to set JAVA HOME properly, no matter which java you have:
export JAVA_HOME=$(dirname $(dirname $(readlink -e /usr/bin/java)))
# Test for jdk installed above jre
if [ -x $JAVA_HOME/../bin/java ]; then export JAVA_HOME=$(dirname $JAVA_HOME); fi
On Ubuntu I've fixed this problem by installing package
openjdk-7-jre-lib
tools.jar appeared after that.
(I know this is an old post, but comment in hope that it will be helpful for somebody lurking for answer like I was today.)