Comman JRE for all OS

Hi experts

i have an client application made using java swings
while deployment on user machines (some are windows and some are linux)
i copy the whole jdk inside the app folder and avoid using
JRE installed on thatmachine.another reason for this is my app requires jdk bcos
jasper reports need the java compiler for compiling the report files at runtime
and JRE does not contain javac compiler

/myapp/myapp.jar  the executable file

now the issue is on linux i have different jdk folder(containing shell scripts) and
on windows i have diffent jdk folder(containing exe's
this is make my life miserable as i have to maintain 2 copies of source and 2 separate
folders for differnt users so that they are not confused
and when i upgrade my version of app the user takes the backup of whole app folder
which is consuming disk(redundant files for images and other folders)

is there a way i can create a single installation folder for both OS

pls help
Who is Participating?
No, or you would have to rewrite everything in pure JAVA yourself.

Mayank SAssociate Director - Product EngineeringCommented:
Well, the JRE is different for different machines, if you understand the concept of JVM and why Java is platform independent, why source files are compiled into class-files or byte-code and why they are interpreted by the JVMs specific to the platforms.
Mayank SAssociate Director - Product EngineeringCommented:
And the JDK for each platform is different too :)
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Mayank SAssociate Director - Product EngineeringCommented:
>> different for different machines

I meant different platforms.
Better verify that the client-machine has a JDK or automate the downloading and installation of the proper JDK.

EconifyAuthor Commented:

hey mayank

i dont know much about JVM,s ,byte-code and platforms as much u know
i think are quite a expert
so instead of writing why...why...why
try to explain the issue

well i guess there a solution....not sure
if i merge the two jdk 1.4 folder then the bin folder will have
the exe's for windows and the scripts for linux
this way windows clients will pick what it requires and linux will get what it wants for running the app

how bout that

any ideas.
Mayank SAssociate Director - Product EngineeringCommented:
Well :) that's why I asked 'if' you understand ;-)

Java is platform independent because it follows a 2-way process. First the source-code is compiled into byte-code which is like an optimized set of instructions. This byte-code is same for all platforms. Then an interpreter interprets this byte-code into platform-specific native code (hence, the interpreter has to be platform-specific). Even the size of primitive data-types are same on all platforms unlike C/ C++.

>> if i merge the two jdk 1.4 folder then the bin folder will have

Well, that's a bad work-around :) what will you do if some client uses Mac later? Add another folder? I don't think that's the right solution. Will need to think more for this.
Yes, Mac, and how about Motorola, VAX, Solaris, HP-PA .... all other versions with another JDK needed.
......... and if new JAVA versions are released?

Take care that the client or customer installs the right JDK,
rather than that you carry everything with your software.

Mayank SAssociate Director - Product EngineeringCommented:
Exactly, you should put JDK as a requirement (pre-requisite) for your application to run. Then depending upon the SLA (service-level agreement), it is either the client's technical group's job to install them on each system where the application is to be deployed, or yours.
Mayank SAssociate Director - Product EngineeringCommented:
The JDK also needs to be 'installed' over the OS, so simply copying the files into a directory will not help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.