• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Achieving Platform independece

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

What i want is to execute my project on any machine, as the platform independence in java says. If say a machine does not even has the jre then start the jre installation. How can i do this??
Would i have to do some batch programming or is there any other way ??

Thanks
 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Compiled Java code (.class) is platform independent however the JVM, on which the .class runs is not platform independent. So you need to install a JVM which is appropriate for the target platform first and then run class file, created in any other platform.

Java achieves this independence by compiling the java code to intermediate system called Virtual Machine, instead of native machine (as C or C++).

If you are asking, how do you install the Java in different platform?

Goto http://java.sun.com, and download the java installation appropriate for your platform in question. You should also be given with instructions to install the same.

Hope this helps.
 
robin singal
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually what i want is if give a jar file to a client who dosen't know anything about java or what?? But knows what the software does. I don't want that him to read the Readme.txt first then install JVM. I want him to just double click a file which instructs him till the software is fully working.

Something that first checks for: if the JRE is there; if not, then start the installation and so on...

I have gone through some batch programming but did not find the appropriate solution.
How can i do this ???

Thanks
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at this list of open source installer generators.

You can use this to create an installer for your application. Some of those, such as JSmooth, can automatically download and install a JRE if the user doesn't have it installed already.
 
robin singal
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, that pretty much took me in right direction..
But what if someone does not have and internet connection or the connection is down at some point of time ..
I would like to give the jre bundled with my application , so that once it is detected that there is no java installed it starts the jre installer present in the subdirectory.
There is also one more issue: if jre older version is installed say(1.3) on a machine and then i install the higher version. Then the path is not automatically update to higher version. The application keeps running in the 1.3 jre.
Then do i have to programatically delete the older path and update with the newer version.

Thanks
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have another look at some of those installers. The website for Launch4J for example says:

Launch4j is a cross-platform tool for wrapping Java applications distributed as jars in lightweight Windows native executables. The executable can be configured to search for a certain JRE version or use a bundled one, ...


So, it seems that you can bundle a JRE with your application with Launch4J. (I haven't used it myself, so I can't tell you how to do it exactly).
 
robin singal
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I tweaked around with launch4j & found it as a good tool...but i am facing problem in giving the bundled jre path.
The path should be for the setup of jre or of the runtime environment already installed???
When i try to run the exe file made from launch4j on the machine with no java installed . It takes me to the download page of sun rather than to the path for the jre setup that i have given in the bundled jre path.

Thanks
 
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic