I want to set my java_home variable,
but have a custom enough OS not to be able
to find my jdk dir as prompted everywhere
(it's a chromium os, and has installed jdk8 by chromebrew...).
What i have is a usr/local/jre folder,
and few java* binaries in usr/local/bin.
Can the jre I have be the same that
everyone refers to as /usr/java or /usr/java/jdk?
The jre folder includes a bin, lib and plugin folder and some tl;dr files.
Thanks a lot!
There is no "standard" definition for the JAVA_HOME, that is you can point it to the folder where either the JRE or the JDK is installed.
The only requirement (which is in fact more of a generally accepted convention) is that $JAVA_HOME/bin/java should start the Java runtime.
This happens if you point JAVA_HOME to either the JDK or JRE folder, in both cases there is a folder /bin and inside the "java" executable.
In your case, since you identified the JRE installation folder, you can point JAVA_HOME to it.
Related
From the existing threads (What tomcat requires JDK or JRE? and Why does Tomcat require JDK installed?) I learned that Tomcat 5.5 onwards does not need an installed JDK to compile jsp files, because it uses its own bundled Eclipse Java Compiler. However, when tomcat runs the java byte code, it does require JRE. But during installation of Tomcat, we only need to specify the location of JVM. To compile and run Java code, we only need to add bin folder under the JDK folder into the path environment. But JDK 9 does not include a JRE folder any more. Instead there is an independent JRE folder outside JDK folder. How does Tomcat still catches JRE when running compiled jsp code? Which configuration file in Tomcat captures this? Thanks!
But during installation of Tomcat, we only need to specify the location of JVM
Specifying the location of the JVM implicitly specifies the location of the JRE, since the JVM is locate inside the JRE directory structure.
To compile and run Java code, we only need to add bin folder under the JDK folder into the path environment.
Adding the JDK bin folder to the PATH, means that you can run the java and javac commands. The location of the command file implicitly specifies the location of the JDK, and hence the JVM, to use. There are no configuration files.
In Windows 64-bit Java 5 to Java 8, the JVM is located in %JAVA_HOME%\jre\bin\server\jvm.dll.
In Windows 64-bit Java 9, the JVM is located in %JAVA_HOME%\bin\server\jvm.dll.
But JDK 9 does not include a JRE folder any more. Instead there is an independent JRE folder outside JDK folder.
The JDK installation programs for all Java versions will create both a JDK folder and a JRE folder, unless you tell it not to create the separate JRE folder. Java 9 is no different that older Java versions in that regard.
How does Tomcat still catches JRE when running compiled jsp code?
Tomcat is itself written in Java, so Tomcat doesn't locate Java. It is Java that runs Tomcat.
I downloaded the newst 1.8.65 JDK a few days ago an the javac file is missing
in case someone believes I accidently downloaded the JRE, here are 2 screenshots
when I browse to the directory I installed the JDK in
C:\Enwicklung\JDK\1.8.65\bin
the javac.exe file isn't there where it should be, as you can see in this second screenshot
can anyone confirm this? tried to install the JDK a second time without any change.
EDIT: of course I searched the whole drive for a javac.exe, no match was found
I was able to solve the "problem" myself. after rechecking every letter of the installation process.
During installation, the installer asks you where you want to install the JDK
I chose the folder C:\Enwicklung\JDK\1.8.65\
A progress bar is displayed and installation continues
Then you are asked
for non-German native speakers
Zielordner = target folder
Ă„ndern = change
In this view, the installation process is asking in which folder I want to install Java
I chose the folder C:\Entwicklung\JDK\1.8.65\ again this leads to the following conflict
in C:\Entwicklung\JDK\1.8.65\ there was a bin\ folder of the JDK installation
The JRE aka its alias Java, which a mindful reader should have noticed, but I obviously missed twice, was installed in the same location overwriting the bin\ folder of the JDK with the bin\ folder of the JRE, deleting all files.
An unneeded mistake on my side. Unfortunately, the German installation process doesn't state anywhere that the JRE is being installed except in the folder name of the Zielorder view and that it's installed in the base folder structure.
In my defense, the installation process does not state explicitly that the JRE is being installed next and the installation, at least in this German version, doesn't warn that folders and files are going to be overwritten, which is an undesirable effect from my point of view.
NOTE: I left the predefined folder name as C:\Program Files\Java\jre1.8.0_65 because otherwise after changing it to C:\Entwicklung\JDK\1.8.65\ there would have been no indication for you to know that the JRE is being installed
I am trying to install Maven 3.3.9 on my new laptop but it seems to be incredibly difficult. I am not sure what changed since versions 3.0 which I have been mostly using but now I cant set M2_HOME, MAVEN_HOME and PATH variables properly.
Maven home page tells me to set it like this:
MAVEN_HOME: C:/apache-maven-3.3.9
M2_HOME: C:/apache-maven-3.3.9
PATH: C:/apache-maven-3.3.9/bin
but that, as you may guess, doesn't work. Whats more, there is even no bin folder inside apache-maven-3.3.9!
I have found directory: C:/apache-maven-3.3.9/apache-maven/src/bin but it doesn't help as well.
How to set it properly?
It seems you downloaded the wrong distributed archive from the Maven website: you downloaded the source and not the binary.
Going to the download page, you need to choose the "Binary zip archive" (or "Binary tar.gz archive"). After that, you can follow the installation steps from the install page but the steps are really straight-forward:
Ensure JAVA_HOME environment variable is set and points to your JDK installation
Extract distribution archive in any directory
Add the bin directory of the created directory apache-maven-3.3.9 to the PATH environment variable
There is no need to set the M2_HOME or MAVEN_HOME environment variable.
If you want to keep your maven installation always up-to-date, it is easier to install it via Homebrew on Mac OS X or Linuxbrew on Linux.
I am using install4J to distribute my application . However i am using serial port in my program therefore i will need the below file to be copied to the target JRE folder
%JAVA_HOME%/lib/ext/comm.jar
%JAVA_HOME%/bin/win32com.dll
%JAVA_HOME%/lib/javax.comm.properties
Is there any way i can do it by getting the Java Home Path via Install4J ?
Thanks
Since JAVA_HOME is not a Windows variable, it will be tricky to get it, and Install4J does not have a JAVA_HOME variable to my knowledge. While JAVA_HOME could be set on some computers, it is not safe to assume it is set on all computers.
What I would do, personally, is not touch the user's JRE. Bundle your own custom JRE with those files included into your install file generated with Install4J. That way, your program will always work with its own custom JRE that is independent of the system's JRE.
Copy the files to
${installer:sys.javaHome}
This is the JRE that the installer and subsequently your launchers run with. If you bundle a JRE, the value of this variables changes after the "Install files" action runs.
When I run ant it says:
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar
Buildfile: build.xml does not exist!
Build failed
What package can I use to download the file required > C:\Program Files\Java\jre6\lib\tools.jar
I just downloaded this one:
jre-6u19-windows-i586-s.exe
but unfortunately it appears that it was not on it...
Java ships in 2 versions: JRE & SDK (used to be called JDK)
The JRE in addition to not containing the compiler, also doesn't contain all of the libraries available in the JDK (tools.jar is one of them)
When you download Java at: http://java.sun.com/javase/downloads/index.jsp, make sure to select the JDK version and install it. If you have both a JDK & JRE, make sure that ANT is using the JDK, you can check JAVA_HOME (environment variable), and on the commandline if you do "javac -version" you should get a version description.
You need JDK for that.
Set JAVA_HOME to point to the JDK.
Using suggestions from answers on this page and this other one (ANT_HOME is set incorrectly or ant could not be located), the ultimate fix was the following:
Adding a ANT_HOME environment variable that points to the ROOT directory of your Apache ant directory location. (Not the bin sub-dir!)
Adding a JAVA_HOME environment variable that points to the ROOT directory of your Java JDK (or SDK) directory location. (NOT your JRE and not the bin sub-dir!)
Appended %ANT_HOME%\bin;%JAVA_HOME%\bin to the PATH environment variable.
Make sure you close any command window(s) that were open prior to the changes above. Only command windows opened after the changes will have the updated environment variables.
I was having the same problem, none of the posted solutions helped. Finally, I figured out what I was doing wrong. When I installed the Java JDK it asked me for a directiy where I wanted to install. I changed the directory to where I wanted the code to go. It then asked for a directory where it could install the Runtime Environment and I selected the SAME DIRECTORY where I installed the JDK. It over wrote my lib folder and erased the tools.jar. Be sure to use different folders during the install. I used my custom folder for the JDK and the default folder for the RE and everything worked fine.
I found that even though my path is set to JDK, the ant wants the tools.jar from jre folder. So just copy paste the tools.jar folder from JDK to jre.
I was also getting the same problem, but i uninstalled all updates of java and now it is working very fine....
Just set your java_home property with java home (eg:C:\Program Files\Java\jdk1.7.0_25) directory.
Close command prompt and reopen it.
Then error relating to tools.jar will be solved.
For the second one("build.xml not found ") you should have to ensure your command line also at the directory where your build.xml file resides.
Sometimes while installing JDK, you may get a dll is missing error. Because of this, it won't copy the tools.jar file to the java folder. So please reinstall the JDK in a different location and if it is successful then you will see the tools.jar file.