I just switch to try develop on Linux for a while.
But one thing I couldn't understand how to solve it, as I mentioned in topic.
I'm going to develop a project that need Java SDK, then I installed the SDK with command:
#bash
sudo apt install openjdk-17-jdk-headless
After installation finished, I could run command java -version and javac -version to see the result of installation and it looks OK.
openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment (build 17.0.3+7-Ubuntu-0ubuntu0.22.04.1)
OpenJDK 64-Bit Server VM (build 17.0.3+7-Ubuntu-0ubuntu0.22.04.1, mixed mode, sharing)
And then when I open IDE (Intellij IDEA) and it has feature of integrated terminal. (see picture)
But when I try to test java -version it was shown the error:
bash: java: command not found
As you can see from picture, I run java -version on terminal it return output properly, but when I run the same command java -version, it output with error message, like it couldn't find the java SDK that I installed.
Could anyone help me to describe the reason and solutions to solve the issue?
P.S. This is same on VS Codium.
I found the answer.
Solution:
Install the IDE app with the file from official website instead of using package manager of OS.
Description:
The cause is I installed the IDE via Package Manager of OS (here I'm using Pop_OS, install via Pop!_Shop)
And its package manager has some strict rules for security purpose.
I'm not sure, Pop_OS using which package manager, but I'll raise Flatpak as reference: https://docs.flatpak.org/en/latest/sandbox-permissions.html
And on blacklisted directories, my installed java command is under /usr/bin/ which is in blacklist.
I'm installing SonarQube v5.0.
I'm running Windows Server 2012 64-bit (a virtual OS), Java 1.8 64-bit, and the SonarQube windows-x86-64 wrapper.
SonarQube, whether run via StartSonar.bat using Command Prompt as Administrator or as a Windows Service, keeps throwing the following warning:
WARNING - Unable to load the Wrapper's native library 'wrapper.dll'.
The file is located on the path at the following location but
could not be loaded:
C:\sonarqube-5.0.1\bin\windows-x86-64\.\lib\wrapper.dll
Please verify that the file is readable by the current user
and that the file has not been corrupted in any way.
One common cause of this problem is running a 32-bit version
of the Wrapper with a 64-bit version of Java, or vica versa.
This is a 32-bit JVM.
Reported cause:
C:\sonarqube-5.0.1\bin\windows-x86-64\lib\wrapper.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
System signals will not be handled correctly.
The only info that I've found on the web is some JIRA's from 2010 that don't really help me. I can't create a sonar user on this Windows installation. All my other tools in my CI environment are running on Java 1.8 64-bit, which means that JAVA_HOME is set to JDK 1.8 64-bit. I really don't want to have to run Java 32-bit and the 32-bit Wrapper. That means that the JRE bin/java path at the top of wrapper.conf will have to specify the 32-bit JRE.
What can I do to get rid of this warning?
Not all applications use JAVA_HOME variable, so you can have JAVA_HOME pointing on your 64 bits version while you are using a 32 bits.
Note: the 'Java_Home' key in the registry is not the JAVA_HOME variable.
Well, one way to be sure is to uninstall the current service, with ..\windows-x86-64\UninstallNTService.bat and install the 32 bits version with ..\windows-x86-32\InstallNTService.bat.
If it works, you definitively have a 32 bits JVM.
Installed the service SonarQube in \sonarqube-5.1.2\bin\windows-x86-64.
I just went to the SonarQube in the Windows Services-->go to properties-->Log On tab--->select 'Local Service'(Entered the system password). Thats it!
Issue was resolved.
Hope this helps someone who was not able to resolve from the above posts.
I experienced the same problem with SonarQube 5.6.4 on Windows 7. Editing the sonar.properties file to add a wrapper.java.command=... had no effect. Editing my path statement did the trick, though.
The first two folders in my path statement had been
C:\ProgramData\Oracle\Java\javapath;C:\dev\sdks\jdk1.8.0_112\bin;....
The java.exe in the first (C:\ProgramData\Oracle\Java\javapath) is 32-bit. I just switched the two in my path:
C:\dev\sdks\jdk1.8.0_112\bin;C:\ProgramData\Oracle\Java\javapath;...
Suddenly SonarQube started using the 64-bit java.exe in C:\dev\sdks\jdk1.8.0_112\bin
After making this change, I was able to restart Firefox without any difficulty.
In my case, running on SonarQube 7.3 on window 7 or window 10, I have to update Java version to java 8 to pass this error.
No need for this, In my case I just Installed Java SE JDK 11.0.16 and installed it, and restarted the sonar server and it worked. Below is the URL to download
https://www.techspot.com/downloads/5553-java-jdk.html
When I try to execute the installer, it starts "Extracting Bundled Java SDK ..." and then fails with "Error: Could not find the required version of the Java(TM) 2 Runrime Environment in '(null)'.".
What can I do? The OS is a Windows 7 Ultimate (just installed), virtualized with KVM under an Ubuntu 13.10.
Firefox and LibreOffice could be installed without any problem.
The pre requisite for JavaEE sdk7 installer is to have Jdk 7. So make sure, your environment variable path is pointing to JDK7\bin folder. And check java -version in command prompt, it should show you jdk 7 is current version in your system.
If both of the above are correct and it still doesn't work, then donot double click on the exe file directly, install it from command prompt, by giving location for JRE7 and
helping the installer to find jar files of JRE7, see below:
D:\installables>java_ee_sdk-7-jdk7-windows-x64.exe -j "C:\
Program Files\Java\jre7"
I had same problem, but this worked for me.
I am getting these errors...
Severe: JRE 1.3 or higher must be installed!
Severe: JDK 1.3 or higher must be installed!
...when installing JAI (Java Advanced Imaging) 1.1.3 on Windows 7 (x64), with JRE 7 (1.7) installed at "C:\Program Files\Java\jre7" and JDK 7 (1.7) installed at "C:\Program Files\Java\jdk1.7.0".
Following http://download.java.net/media/jai/builds/release/1_1_3/INSTALL.html#Windows, specifically this is what I did:
Visited:
http://download.java.net/media/jai/builds/release/
http://download.java.net/media/jai/builds/release/1_1_3/ (latest version)
Downloaded:
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586-jdk.exe
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586-jre.exe
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586.exe
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586.jar.zip
EDIT (QUESTION): It would be great if someone could break down the difference between these files. The instructions at http://download.java.net/media/jai/builds/release/1_1_3/INSTALL.html#Windows do not go into enough detail and assume you already know what's what.
EDIT: As noted in the comments below, the .exe are exclusive installs, but I wished to install them to all three locations (to "C:\Program Files (x86)\Sun Microsystems\Java Advanced Imaging 1.1.3" as well as to my JDK and JRE locations), as I was not sure which I would need at my work as a Java developer. As far as I know, I just need to install the JDK version, and the .zip is a manual install of the same thing. I am not sure though! Unverified.
Installed:
jai-1_1_3-lib-windows-i586.exe (installed fine)
jai-1_1_3-lib-windows-i586-jre.exe <---- this is what causes one of the errors.
jai-1_1_3-lib-windows-i586-jdk.exe <---- this is what causes one of the errors.
The errors appear to be the same issue of not finding where Java (JRE and JDK) is installed.
I have the following environment variables set:
JAVA_HOME = C:\Program Files\Java\jdk1.7.0
Path = ...;C:\Program Files\Java\jdk1.7.0\bin
EDIT: This makes me think the problem is something deeper than environment variables, as there's no environment variables for JRE like there is for JDK (i.e., JAVA_HOME), right?
Fixes I have tried (to no avail):
Re-installing*.
Re-downloading and re-installing*.
Adding "C:\Program Files\Java\jre7\bin" to "Path" and re-installing*.
Adding "C:\Program Files\Java\jre7" to "Path", without removing the above Path addition, and re-installing*.
Adding "C:\PROGRA~1\Java\jre7" to "Path", and verified it was the proper folder, and re-installing*.
Changing JAVA_HOME from "C:\Program Files\Java\jdk1.7.0" to "C:\PROGRA~1\Java\JDK17~1.0", and verified it properly forwards back to the original folder in Windows, and re-installing*.
Re-installing Java to a non-space folder, "C:\xxx\xxx\jdk1.7.0", where the x's are letters not spaces, and verified it works properly with "java -version" command line, and re-installing**.
*Downloading and installing jai-1_1_3-lib-windows-i586-jre.exe
**Downloading and installing jai-1_1_3-lib-windows-i586-jdk.exe
None of this worked. :(
I have not tried:
Using an older JRE than 7 (1.7)
Any help would be great.
POSSIBLE (HACK) SOLUTION: What about manual installation? It's what we've opted to do at work. Is it possible to figure out what files are installed (without installing it since I cannot)?
EDIT: I have also verified that "JAI (Java Advanced Imaging) Image I/O" has the same problems on my system.
JAI is only available on 32bit (x86) JRE, so you need to install the 32 bit JRE on Windows 7.
JAI uses some native implementations (dlls) in order to accelerate the processing, so only installs on a 32bit JRE.
When installing JAI, it tries to detect the installed JRE and should be a 32bit JRE. You can install 32bit JRE on a Windows 7 x64, the only "difference" is the performance and the maximum memory available to java applications.
Install JAva 7 JRE 32bit from http://www.oracle.com/technetwork/java/javase/downloads/java-se-jre-7-download-432155.html select "Windows x86 Offline".
Another way is manual installation from JAI as zip, use jai-1_1_3-lib-windows-i586.jar.zip and execute from the 32bit JRE.
install a JRE version 1.3 or later? (and make sure that your PATH points to it)
[edit]
Are you sure there's a problem? It seems that 3 files you downloaded are mutually exclusive (that's what I got from reading the installation instructions)
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586-jdk.exe
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586-jre.exe
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586.exe
Installing -jre or -jdk may be redundant
I installed the jre version and it asked me for a jre directory - any of that happen to you?
[/edit]
try to install (reinstall) java (jre) in folder without any spaces. For example C:\Java\jre7.
You must install 32-bit version of jdk
I solved this problem by installing 32-bit version of jdk.
My OS is window 8 64-bit.
when installing jai-1_1_3-lib-windows-i586-jdk.exe and jai_imageio-1_1-lib-windows-i586-jdk.exe with double clicks, i got the same error "Severe: JRE 1.3 or higher must be installed!"
then I downloaded jdk-7u21-windows-i586.exe and installed it in "c:\Program Files (x86)\Java".
and then it's OK.
I would like to use the WatchService API as mentioned in this link:
http://download.oracle.com/javase/tutorial/essential/io/notification.html
After reading around, I found out that WatchService is part of the NIO class which is scheduled for JDK 7. So, it is in beta form. It's fine.
http://jdk7.java.net/download.html has the JDK which I downloaded and extracted. I got a bunch of folders. I don't know what to do with them.
Then, I read around some more and found that some nice group of people created JDK 7 as a binary so someone like me can install it easily. It is called Open JDK:
http://code.google.com/p/openjdk-osx-build/
So, I downloaded the .dmg file and install it. Then I open "Java Preference" and see that OpenJDK7 is available.
So, now I feel that I can start trying out WatchService API. From the tutorial in the first link, the author gave a .java file to test it out first and make sure that it is running. Here is the link to the file:
http://download.oracle.com/javase/tutorial/essential/io/examples/WatchDir.java
So, I boot up Eclipse (actually I use STS) and create a new Java project and choose JaveSE-1.7 in the "use an execution environment JRE:". Under the src folder, I copy pasted the WatchDir.java file.
And I still see tons of squiggly red lines. All the "import.java.nio.*" are all red and I cannot run it as a Java app.
What do I need to do?
This is how I got 1.7 to work with Eclipse. I hope it helps.
I Downloaded the latest OpenJDK 1.7 universal (32/64 bits) JDK
from Mac OS/X branch from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
copied the jdk to /Library/Java/JavaVirtualMachines/ next to the
default 1.6.0 one
In Eclipse > Preferences > Java > Installed JREs you add a new one, of type MacOS X VM, and set the home as /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home and
name Java SE 7 (OpenJDK)
Click Finish
Set the added JRE as default
that should be it :)
Oracle has released JDK 7 for OS X.
Java 9, 10, 11
Years ago, Apple joined the OpenJDK project, transferring their formerly proprietary macOS-specific JVM code as free-of-cost open-source. Apple ceased distribution of their own branded JVM/JDK, relying on Oracle’s branded releases to include a version for macOS.
Oracle has recently announced their intention to bring their Oracle-branded JVM release to feature parity with the OpenJDK project, with virtually the same code base. The company even donated their previously commercial tools, Flight Recorder & Mission Control, to the OpenJDK project. This is part of the shift to a new rapid “release train” plan for predictably scheduled versioning of Java and OpenJDK. Notably, the periods for free-of-cost public updates is now shortened. See this 2017-09 announcement and this posting by Mark Reinhold.
As a result of all this, macOS users of Java have a choice of vendors for a Java implementation. At this point, at least three sources are based on OpenJDK for macOS:
Oracle releases of the JDK and JRE, with optional paid support.
Azul Systems releasing:
Zulu line of free-of-cost JVMs with optional paid support.
Zing line of commercial JVMs with special features such as an alternate garbage-collector.
OpenJDK source code, roll-your-own compilation & installation (perhaps not practical for most of us).
Meanwhile, IBM donated code for a JVM to the Eclipse Foundation, now housed in the OpenJ9 project. I wonder if they might support a macOS release as well, though it is too soon to tell.
Personally, I am currently using the Zulu release of Java 10.0.1 from Azul on macOS High Sierra successfully with IntelliJ 2018.2 to produce Java-backed web apps with Vaadin.
Installation/Removal
Both Oracle and Azul provide utterly easy-to-use installers to install the JVM/JDK on your Mac. Verify your installation by using the Terminal.app (or equivalent) to type and run:
java -version
You will find the Java installations in this folder at the root level of your drive (not in your home folder):
/Library/Java/JavaVirtualMachines
Each version from each vendor is found there, in a labeled nested folder. You can delete any installation simply by deleting the nested folder for that version and providing your system password when prompted.
Java 8
You can download the Java Development Kit (JDK) for Java 8 for the supported versions of Mac OS X:
Mountain Lion (10.8.3+)
Mavericks (10.9)
Yosemite (10.10)
El Capitan (10.11)
Each version of JVM you install can be found here:
/Library/Java/JavaVirtualMachines
For more instructions and FAQ, see this Oracle Guide.
Java 7
For every release of Java 7 since Update 4, a Mac version has been ready alongside the other platforms. Runs on Macs with 64-bit hardware on Lion (10.7.3+), Mountain Lion (10.8.3+), and Mavericks (10.9.x).
Oracle announced the official release of the JDK for Java SE 7 Update 4 on Mac OS X (Lion), as of 2012-04-26. No more need for the tricks discussed on this page.
Installation is simple per these instructions:
Download from the usual place on the Oracle web site.
Mount the DMG.
Run the installer.
This release has a few limitations, most notably the lack of support for Java Web Start and the Java Plugin for web browsers. That support is expected later this year.
After installing, read the JDK for Mac ReadMe. Most importantly, if you want Java 7 to be the default, drag it to the top of the list in the Java Preferences app found in your Utilities folder.
Mac OS X easily supports multiple JVMs simultaneously. Each is now found here:
/Library/Java/JavaVirtualMachines
Congratulations to the Apple & Oracle teams for their achievement. This geek gets a thrill seeing Mac OS X listed as a "Certified System Configuration".
Tip: To start Eclipse on a Mac with only Java 7 installed, open the alias file named eclipse rather than the file named Eclipse.app.
Java 6
Apple continues to supply an up-to-date implementation of Java 6 for all versions of Mac OS X up through Mountain Lion.
If you do something that requires Java, such as type "java -version" in Terminal.app, a dialog appears offering to install Java for you. If you accept, installation happens automatically similar to other "Software Updates" from Apple.
You will find Java installed in this location, different than Java 7 & 8:
/System/Library/Java/JavaVirtualMachines
Java 6 has reached end-of-life with Oracle as of 2013-02 (unless you have a commercial support agreement with Oracle). So you should be moving to Java 7 or 8.
Testing New Version
In Terminal.app, type java -version to verify which version is the current default.
Deleting Old Versions
After installing a fresh version, you may want to visit the folder described above to delete old versions. Move the folder to the Trash, and provide your System password complete the move.
By the way, Apple provides a mailing list for developers’ technical issues related to Java on OS X.
An easy way to install Java 7 on a Mac is by using Homebrew, thanks to the Homebrew Cask plugin (which is now installed by default).
Run this command to install Java 7:
brew cask install caskroom/versions/java7
Get cask
brew tap caskroom/cask
Install java7:
brew tap caskroom/versions
brew cask install java7
(I had difficulty finding the download link of java7 on oracle website, as they're just "recommending" java8 )
EDIT January 2018 (As pointed by Ankur):
Use zulu7 cask. Zulu is a certified build of OpenJDK produced by Azul Systems that should be around for a long time (they even offer JDK6 builds still).
brew cask install caskroom/versions/zulu7
I know that some may want to smack me for re-opening old post, but if you feel so do it I just hope this may help someone else trying to set JDK 7 on Mac OS (using IntelliJ).
What I did to get this working on my machine is to:
followed instructions on Oracle JDK7 Mac OS X Port for general installation
in IntelliJ open/create new project so you can add new SDK (File > Project Structure)
select Platform Settings > SDKs, press "+" (plus) sign to add new SDK
select JSDK and navigate to /Library/Java/JavaVirtualMachines/JDK 1.7.0 Developer Preview.jdk/Contents/Home. Do not get it mistaken with /Users/YOUR_USERNAME/Library/Java/. This will link 4 JARs from "lib" directory (dt.jar, jconsole.jar, sa-jdi.jar and tools.jar)
you will need also add JARs from /Library/Java/JavaVirtualMachines/JDK 1.7.0 Developer Preview.jdk/Contents/Home/jre/lib (charsets.jar, jce.jar, JObjC.jar, jsse.jar, management-agent.jar, resources.jar and rt.jar)
after installing the 1.7jdk from oracle, i changed my bash scripts to add:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home
and then running java -version showed the right version.
It's possible that you still need to add the JDK into Eclipse (STS). Just because the JDK is on the system doesn't mean Eclipse knows where to find it.
Go to
Preferences > Java > Installed JREs
If there is not an entry for the 1.7 JDK, add it. You'll have to point Eclipse to where you installed your 1.7 JDK.
If Eclipse can't find a JRE that is 1.7 compatible, I'm guessing that it just uses your default JRE, and that's probably still pointing at Java 1.6, which would be causing your red squiggly lines.
I needed to adapt #abe312's answer since there has been some changes with brew lately.
I installed zulu7 and setup JAVA_HOME by running:
brew install --cask homebrew/cask-versions/zulu7
echo "export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-7.jdk/Contents/Home" >> ~/.zshrc
I had to enter my password for installing zulu7. You may need to modify the last command if you are using a different shell.
How about Netbeans, here is an article how to set it up with NB7:
http://netbeanside61.blogspot.com/2011/06/downloading-openjdk7-binary-for-mac-os.html
Maybe similar steps for Eclipse.
As of April 27th there is an offical Oracle release of Java SE 7u4. Download the disk image and run the installer - then see the Mac readme.
As of December 2017, previously posted links don't work, but JDK 7 can still be downloaded from Oracle Archives (login required):
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
The instructions by peter_budo worked perfectly. I had to add the jars under /Library/Java/JavaVirtualMachines/JDK 1.7.0 Developer Preview.jdk/Contents/Home/jre/lib/ to my IntelliJ project libraries. Now it works like a charm. Note that I didn't need my IDE itself to run under 1.7; rather, I only needed to be able to compile and run against 1.7. I'll most likely continue to use Apple's JRE for running the IDE since it's probably more stable with respect to graphics routines (Swing, AWT). Like the OP, I was really keen on testing out the new NIO2 API. Looking good so far. Thanks, Peter.
What worked for me on Lion was installing the JDK7_u17 from Oracle, then editing ~/.bash_profile to include:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home
Now, Use command
Update 2020: 04
To install Java7 with homebrew run:
brew tap homebrew/cask-versions
brew cask install java7
Hope this help.
I updated to Yosemite and Android Studio wouldn't clean my projects or Run them on virtual or real device because of the following error:
Failed to complete Gradle execution.Cause:Supplied javaHome is not a valid folder. You supplied: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
After some research and trouble shooting, I found that the JDK file that was being pointed to at "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home" wasn't there; all of "JavaVirtualMachines/1.6.0.jdk/Contents/Home" was missing from "/System/Library/Java". So, I copied "JavaVirtualMachines/1.6.0.jdk/Contents/Home" over from "/Library/Java/" to "/System/Library/Java/" and cha ching! I was back in business.