The Anylogic installation package (v. 8.2.3) includes JRE (Java version 9.0.1).
I need to run Anylogic with a different JRE (Java 8)
Is this possible?
Yes, it is possible. AnyLogic uses built-in JRE, located in AnyLogic installation folder. At Windows it looks like this: C:\Program Files\AnyLogic 8 Professional\jre
You can install Oracle JRE and copy its jre1.8.0_... folder in AnyLogic installation folder. Rename the existing jre to jre_9, jre1.8... to jre. Launch AnyLogic, it will use the respective JRE.
Related
I am writing a Java Swing application. I downloaded JRE for Linux platfrom from Oracle website and just bundled this JRE my application.
I have given a launcher script, in which I am referring the bundled JRE bin/java executable. So it works fine.
My question is, what is the difference between installing the JRE by downloading from the Oracle website and this procedure?
What are the extra parameters set by the JRE installer in my Linux machine apart from copying JRE files?
What are the environment variables set and what are the shared libraries copied? Any idea?
It depends a lot on how you install.
First, I assume you are talking about Java 8, since later versions of Java don't come with a separate JRE.
For Oracle Java 8 installations for Linux, there is a choice of rpm or other package installers or the basic Linux manual installation. The latter is described here. As you can see from the documentation, it's just a simple tar.gz which you unzip/untar into a directory of your choice, and that's it. The same as your bundled JRE.
if you want develop a application. you should download jdk, not jre.
jdk: java develop tookit
jre: java runtime.
linux has an old openjdk, but you can download jdk from oracle website. just download a xx.tar.gz, and untar it into:
/usr/java/jdk1.8xx
and set path:
JAVA_HOME=/usr/java/jdk1.8.0_121
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATH CLASSPATH
It's not a duplicate. I would like to get current JRE version while program is executing.
To test result I've installed JDK 8.91 (without JRE 8.91 installation) and JRE 8.77. Also I've created JRE_HOME, JAVA_HOME variables, excluded Path variable with JDK folder.
My Tomcat uses JRE so I would like to get current JRE version before I will launch it. I found solution like:
System.getProperty("java.version")
After executing
System.out.println(System.getProperty("java.version"))
I get result 1.8.0_91 Instead of 1.8.0_77, which I wanted to get.
However, Oracle documentation gives the definition that this is JRE version.
Link:http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html#getProperty%28java.lang.String%29
How can I fix it?
When you run a Java program, it always runs on a JRE (Java Runtime Environment). You cannot run a program on the JDK directly.
When you install Oracle's JDK, a JRE is included, you can find it in the jre directory in the JDK installation directory.
When you install Oracle's JDK, you get an option to install a "public JRE". This is a JRE that is installed separately from the JDK itself, and is used by browser plug-ins. You need this only if you want to be able to run Java applets in your browser.
I installed jdk 1.8. While installing, two JRE were copied to my computer:
The first is inside JDK folder and the second is outside .What's the purpose of having two JRE in the same Operating System .
Isn't one JRE enough to handle all requests .
Private vs. public JRE - Installing the JDK installs a private Java SE
Runtime Environment (JRE) and optionally a public copy. The private
JRE is required to run the tools included with the JDK. It has no
registry settings and is contained entirely in a jre directory
(typically at C:\Program Files\jdk1.6.0\jre) whose location is known
only to the JDK. On the other hand, the public JRE can be used by
other Java applications, is contained outside the JDK (typically at
C:\Program Files\Java\jre1.6.0), is registered with the Windows
registry (at HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft), can be removed
using Add/Remove Programs, might or might not be registered with
browsers, and might or might not have java.exe copied to the Windows
system directory (making it the default system Java platform or not).
Source: http://www.oracle.com/technetwork/java/javase/install-windows-189425.html
Browser will run from java/jre
Java running from java/jdk/jre
When we install internet Explorer it will download jre
JDK/jre wil be use by the command line tool because command line default java home will be set to jdk with it looks for jre and run the java.exe inside the jdk/jre
Before downvoting or close-requesting this question please see that this question is about JDK 7 not 6, it has a second question 'Q2' which is not addressed by any duplicate thread and this question is about four not only two java.exe instances. Thank you!
I've just installed Oracle's Java SE JDK (64 bit) which resulted in the following directory layout, and somehow two JREs:
C:\Program Files\Java\
\jdk1.7.0_40
\jre
\jre7
I'm now the proud owner of four java.exe executables:
C:\Program Files\Java\jdk1.7.0_40\bin\java.exe
C:\Program Files\Java\jdk1.7.0_40\jre\bin\java.exe
C:\Program Files\Java\jre7\bin\java.exe
C:\Windows\System32\java.exe
Q1: Which one should I put into my search path to execute Java-based applications?
Q2: Do I need to put the Unlimited JCE Policy files just into the security sub-directory of the corresponding JRE in my search path or also into all others in order to work correctly?
While installing JDK you will have a copy of JRE installed automatically. You need not install a copy of JRE separately. yet this will be your directory structure.
The copy of JRE in the JDK folder is for the is a private copy of JRE.
Installing the JDK installs a private Java SE Runtime Environment (JRE) and optionally a public copy. The private JRE is required to run the tools included with the JDK. It has no registry settings and is contained entirely in a jre directory (typically at C:\Program Files\jdk1.6.0\jre) whose location is known only to the JDK. On the other hand, the public JRE can be used by other Java applications, is contained outside the JDK (typically at C:\Program Files\Java\jre1.6.0), is registered with the Windows registry (at HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft), can be removed using Add/Remove Programs, might or might not be registered with browsers, and might or might not have java.exe copied to the Windows system directory (making it the default system Java platform or not)."
Which one should I put into my search path to execute Java-based
applications?
According to the "JDK and JRE File Structure" document, you should add jdk1.7.0\bin to the path:
c:\jdk1.7.0\bin
Executable files for the development tools contained in the Java Development Kit. The PATH environment variable should contain an entry
for this directory. For more information on the tools, see the JDK
Tools.
Do I need to put the Unlimited JCE Policy files just into the security
sub-directory of the corresponding JRE in my search path or also into
all others in order to work correctly?
According to the "Unlimited Strength Java(TM) Cryptography Extension Policy Files" documentation you will need to install the unlimited strength policy JAR files for all JREs that you plan to use.:
On Windows, for each JDK installation, there may be additional
JREs installed under the "Program Files" directory. Please make
sure that you install the unlimited strength policy JAR files
for all JREs that you plan to use.
So i decided to try the beta of android studio today, but it refuses to run on my 32-bit JRE. I can download the 64-bit JRE, but im not interested in it being my default JRE for various reasons (my current 32-bit eclipse IDE, Processing IDE and Minecraft doesn't like 64-bit to my experiences), and i think that swithing java_home dir all the time will be cumbersome.
So does intelliJ have some way of setting an alternative JAVA_HOME dir like eclipse does in its ini?
In IntelliJ you can specify which SDK to use at project level. go to "File" --> "Project Structure" --> SDKs (list on the left) and you can add/remove paths to different SDKs
Other solution: If you use Windows then I think you can specify JAVA_HOME as system property just for IntelliJ. If you use Linux the solution is similar.
I use IDEA_JDK for this purpose (on linux).
I believe it is STUDIO_JDK for android studio.
For more information on this and other jetbrains IDE's, see https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under
The other answers will not work for 64bit versions. Jetbrains have actually documented this quite well. From https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under:
Java 8
Please be aware that Java 8 is required to run IntelliJ IDEA starting from version 16 on all the supported platforms. It also applies to the lightweight IDEs released from the same branch (144+).
Windows
JDK is bundled with all the product installers and it's recommended that you will use the provided JDK version unless there are any specific issues.
32-bit JDK is located in IDE_HOME\jre directory and is used by the 32-bit product executable.
To run the IDE in 64-bit mode you will need to download and install 64-bit JDK (not JRE) distribution and install it yourself. IDE will find and use it from the registry when you run the 64-bit .exe file (available only for IntelliJ IDEA right now, other products can use the .bat file to run in 64-bit mode).
<product>.exe uses this JDK search sequence:
IDEA_JDK / PHPSTORM_JDK / WEBIDE_JDK / PYCHARM_JDK / RUBYMINE_JDK / CLION_JDK / DATAGRIP_JDK environment variable (depends on the
product, WEBIDE_JDK applies to both WebStorm and PhpStorm before
version 2016.1)
..\jre directory
system Registry
JDK_HOME environment variable
JAVA_HOME environment variable
idea64.exe uses this JDK search sequence:
IDEA_JDK_64 environment variable
..\jre64 directory
system Registry
JDK_HOME environment variable
JAVA_HOME environment variable
It’s also possible to start the IDE with .bat file located in the bin directory, it uses the following JDK search sequence:
IDEA_JDK / PHPSTORM_JDK / WEBIDE_JDK / PYCHARM_JDK / RUBYMINE_JDK / CLION_JDK / DATAGRIP_JDK environment variable (depends on the product)
..\jre directory
JDK_HOME environment variable
JAVA_HOME environment variable
Environment variable must point to the JDK installation home directory, for example:
c:\Program Files (x86)\Java\jdk1.8.0_66
The actual JDK version used by the IDE can be verified in Help | About dialog (open any project to access the menu).
Define IDEA_JDK / PHPSTORM_JDK / WEBIDE_JDK / PYCHARM_JDK / RUBYMINE_JDK / CLION_JDK / DATAGRIP_JDK variable depending on the product to override the default version from IDE_HOME\jre.
Use Rapid Environment Editor to add/edit the variables, it will detect incorrect paths.
Linux
Starting from IntelliJ IDEA 16 and the most recent versions of the lightweight IDEs, we are bundling custom JRE with Linux distributions, just like we've been doing for Mac. Our custom JRE is based on OpenJDK and includes the most up to date fixes to provide better user experience on Linux (like font rendering improvements and HiDPI support).
Boot JDK path is stored in the .jdk file located in the config folder. It can be modified either via the Change IDE boot JDK action or by manually editing .jdk file (if you can't start the IDE to change it via an action).
It's recommended to use the bundled JRE (if available). In case you have any issues with the bundled version, you can switch to the latest version of Oracle JDK or OpenJDK available for your system (OpenJDK 1.6 is not supported, please use 1.7 or later versions, JDK 1.8 is recommended and older Java versions are not supported starting from IntelliJ IDEA 16).
Check bin/.sh file for the JDK search order, it's similar to Windows in terms of the environment variable names. It's a legacy way to adjust the boot jdk, use it for older product versions. Consider using .jdk file instead (see above), so that your modifications can survive IDE updates/re-installation.
Check this answer if you need to install the JDK manually on Linux.
If you have problems with ugly fonts, please see this thread comments for the tips.
Help | About will show the actual JDK version.
Mac OS X
Our latest IDE versions come with the bundled custom JDK 8 which contains the fixes for most known OpenJDK bugs. Should you need to use a different Java version, please refer to https://blog.jetbrains.com/idea/2015/05/intellij-idea-14-1-4-eap-141-1192-is-available/.
If you override IDE JDK version, its path is stored in .jdk file located in the config folder (idea.jdk for IntelliJ IDEA, pycharm.jdk for PyCharm, etc). Delete this file or change the path inside the file manually in case IDE no longer starts and you can't change it via the menu.
If IDE doesn't start and this file doesn't exist, create it manually and specify Java path to use (Java home location), for example:
/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk
A reminder - once you set up a JAVA_HOME env variable in Windows, you need to close all your IntelliJ apps, and then start again. Otherwise, there might be troubles with accessing JAVA_HOME variable.