How does JRE installation work?


I was working on packaging my software and wondering how does the installation of JRE work. Does it simply copy the binaries on the local system and set the classpath accordingly or any other steps are done by the installer?

For windows the JRE binaries are stored in C:\Program Files\Java\jre7 can I copy this folder into some other machine(with same processor 32bit or 64bit) to make JRE work. If that is so then what are the environment variables that are needed to be set?



<em>can I copy this folder into some other machine(with same processor 32bit or 64bit) to make JRE work</em>


Yes, no problem. Unless you also want to register the .jar extension so that you can double-click them.

In that case check out the ftype and assoc commands. They can do that e.g. from within a batch file or installer.


<em>If that is so then what are the environment variables that are needed to be set?</em>


No need to set any environment variable.

Just make sure you qualify the path to javaw.exe (or java.exe) correctly when starting your application (e.g. through a batch file).


You can put the whole JRE in a sub directory and just reference java.exe based on the sub directory. This is done quite frequently by other products.

You don't need to set any Environmental variables.


If this is a commercial application that is not a JRE toolkit (i.e. something like Maven or Ant) do not rely on the global Environmental variables JAVA_HOME, PATH or CLASSPATH to be set. If you want to create a batch file that when ran, automatically sets that in the context of your application, that'll work fine. But do not rely on them to be set in the System.

All it will take is for someone to change these to use some version of 1.7, or 1.8 beta, or really any sub-version of the JRE to break your application and then you'll get Customer Support calls about your application breaking, when really what they did was change their JAVA_HOME to something absurd because they misread the Ant documentation.

If you are providing a toolset that works in conjunction with the JDK, such as Ant or Maven, you'll probably want to use whatever JRE/JDK they have installed as that is the point of your tools.


If you don't specify any argument, the JRE installer install the needed binary and executable files, but also creates the needed windows registry entries to configure your JRE installation.

You can also install using the "-static" option (see the JRE installer <a href="http://www.oracle.com/technetwork/java/javase/silent-136552.html" rel="nofollow">documentation</a>) in which case doesn't do anything else but copying the files to the specified path.

Then you'll need your environment variables manually. For the command-line, the most common ones are: PATH, JAVA_HOME and CLASSPATH.


The short version is, it depends. But for the most part, the constraints of binary compatibility and library paths are sufficient to get the JRE working in shared environments (as we do in some of our machines at work).

Because Java provides a virtual machine to handle requests, and because it can do so fairly independently of some of the other bells and whistles owned by the system, your intuition about its classpath and binary disposition holds true. <em>However</em>, you may run into problems with libraries that expect a well-formed and system-specific set of paths and libraries, which are afforded in some of the OS packages provided by third-party libraries.

In short: if you have the option to, install Java from its installer, because this will guarantee all classpath details, all libraries, all logging facilities, and all system-specific errata are accounted for, though as Andrew Finnell points out, you'll <a href="https://stackoverflow.com/questions/560797/why-doesnt-the-java-sdk-installer-set-java-home" rel="nofollow">still need to set the environment variables manually</a>. Only a strict subset of these are <em>required</em> for most needs (see the other answers), but it's the corner cases that are most interesting when bounding this class of problem.


  • Remove the default 00:00:00 time in daily bar plots?
  • Populating new variable using vlookup with multiple criteria in another variable
  • How to plot a network without background connection or labels? R pegas
  • Upsampling Dataframe in Pandas with Index + Column
  • python bar graph and line graph in same chart with pandas & matplotlib
  • Push images into Gstreamer pipeline
  • Merging two data frames with different sizes and missing values
  • huffman implementation without sorting
  • Count the number of times (frequency) a string occurs
  • statsmodles AR model error when calling params
  • Pinvoke upon return of int, API
  • Adding element at nth position by passing linked list when passed by reference not working
  • Play sound in .NET using generated waveform data
  • UTF-8 Character Encoding with TermDocumentMatrix
  • Bokeh time series plot annotation is off by 1 hour
  • How can I write an ICS file for the Friday before the first Saturday of the month?
  • Python - Number of word occurrences
  • using outer function to get a table of values returned by a user defined function
  • Not getting top5 values for each month using grouper and groupby in pandas
  • Return dataframe with range of dates
  • Pandas group by time with specified start time with non integer minutes
  • Merge pandas dataframe on time and another column
  • pandas calculating mean per month
  • Need to join 2 tables but except some rows in another table in MySQL
  • scanf() gets skipped in for loop
  • Why after using table() floating numbers are considered as integers?
  • Create bool mask from filter results in Pandas [duplicate]
  • Comparing FFT of Function to Analytical FT Solution in Matlab
  • Using statsmodels.seasonal_decompose() without DatetimeIndex but with Known Frequency
  • Pandas unstack doesn't work
  • Interpolate and fill pandas dataframe with datetime index
  • JS generate random boolean
  • How can I divide one column of a data frame through another?
  • Reorder factor in MultiBarChart with NVD3 rCharts
  • Axis numerical offset in matplotlib
  • understanding difference in results between dplyr group_by vs tapply
  • Audio sampling rate of an ip camera and FFT
  • How do you create a date range spanning multiple days with only some intra-day values in pandas?
  • Generating new time series index from existing data set in Pandas
  • Python Aggregation on time-series
  • not able to remove tags that “xsi:nil” in them via xslt
  • Append two Pandas series to a dataframe by columns
  • Different results in 16 bit int machine(MSP430) and 32 bit int machine(ARM CORTEX) in a subtraction
  • Can a JOB be created dynamically inside a trigger?
  • How to add power law likelihood to Netlogo Model
  • How can I run in Crypto++ library benchmarks test?
  • pandas.DatetimeIndex.snap timestamps to left occurring frequency
  • How to convert spectral density to amplitude
  • Counterpart of .NETs NetworkStream / SslStream in Delphi 7 [closed]
  • Pandas DatetimeIndex indexing dtype: datetime64 vs Timestamp
  • Undo a Series Diff
  • Create a Windows executable (.exe) from Batch and Vbscript
  • IE error with Angular 2
  • Gradle project for plain Java and Android with single source tree
  • algebraic expressions in python
  • can't compile openssl because of 'cl' is not recognized
  • Cannot get the average date using pandas
  • OO program and SQL database
  • Unable to create .feature file in Pycharm Community
  • Attempt at parsing packets: Is there a Java equivalent to Python's “unpack”?
  • Invalidate node cache when using Jest
  • TypeError: unsupported operand type(s) for -: 'str' and 'str' in python 3.x Anac
  • open source, multi-platform, browser-based screen capture extension? [closed]
  • LDA: Why sampling for inference of a new document?
  • Removing Labels from Legend in ggplot2
  • Convert DOC to PDF [closed]
  • getResource() to a file on runtime
  • Batch file working differently if ran in administrator mode
  • Install 3rd Party Libraries with Transitive Dependencies / Dependency Tree?
  • How to make Plotly chart with year mapped to line color and months on x-axis
  • How do I generate a Sine Sweep in Java (Android)
  • Sails.js API passport.js authentication
  • rapply over a nested list in R
  • c++ regex_replace not doing intended substitution
  • Use tryCatch within R loop
  • Yii2: Finding file and getting path in a directory tree
  • using System.Speech.Synthesis with Windows10 universal app (XAML-C#)
  • GAE: Way to get reference to an HttpSession from its ID?
  • Spring boot 2.0.0.M4 required a bean named 'entityManagerFactory' that could not be found
  • Web.config system.webserver errors
  • What is the purpose of TaskExecutor in spring?
  • Sequential (transactional) API calls in angular 4 with state management
  • How solve “Qt: Untested Windows version 10.0 detected!”
  • How to attach a node.js readable stream to a Sendgrid email?
  • Use of this Javascript
  • Checking free space on FTP server
  • C++ Partial template specialization - design simplification
  • Change Inet root folder for iis 7
  • Java: can you cast Class into a specific interface?
  • Spring Data JPA custom method causing PropertyReferenceException
  • C# - Serializing and deserializing static member
  • AES padding and writing the ciphertext to a disk file
  • Updating server-side rendering client-side
  • How to extract text from Word files using C#?
  • Sending data from AppleScript to FileMaker records
  • Updated Ionic CLI but shows previous version (Windows)
  • How to get next/previous record number?
  • Python: how to group similar lists together in a list of lists?
  • How to include full .NET prerequisite for Wix Burn installer
  • embed rChart in Markdown
  • Is it possible to post an object from jquery to bottle.py?