• How to run a java program in other computers without installing jdk

    Abhey Member

    I am a new in java programming. i have created a small java program and i want to run this on my friends computer is there any method to save my program and i can run on any other pc in which there is no jdk installed or simply please tell me how to run a java program or application in other computers without installing jdk and compiling and then running. i moved from C language and in c there were an exe file created and we can use it anywhere is there any thing in java?????

  • SapnaVishwas Member

    This is possibly the biggest limitation of Java, yet in the same respect a strength oddly. The Java Runtime Environment, or Java Virtual Machine, or whatever you want to call it is required to run any code written in Java – compiled or not. The JRE is what allows “write once, run anywhere”; cross platform compatibility. But like me, and many others, it obviously didn’t become apparent until you realized that Java would be a requirement… I was just enticed by the words “cross-platform”. This fact is one of the reasons that I’ll be rewriting my software in C# and Objective C when I get chance.

    Anyway, if you use Launch4J you can ‘convert’ your JAR file(s) to an executable and also ‘bundle’ a JRE with it. However, all ‘bundling’ does is tell the executable to look for a JRE in a relative directory; so essentially you would just be carrying the JRE around with you program. To me, it makes more sense just to tell people they need Java because a lot of people already have it, and an increasing amount of people would object to using Java. So rather than forcing a JRE on people, or loading one on a machine that already has it you should give people options. You could even use something like InnoSetup to create an installer that offers to automatically download and install Java if it is not on the machine.

    I noticed that you’ve said PC specifically, but if you wanted to deploy your program for Mac, I’ve found this to be a good place to start:


    There are actually compilers out there that claim to convert your Java applications to native executables, but I’ve never had any experience because they don’t tend to like GUIs. They’re picky to say the least, and I think you’ll only have limited success in this area, but you might like to check the following link anyway or do a quick search for “java to native”.


Viewing 1 reply thread
  • You must be logged in to reply to this topic.