0

I am new to java and writing my own launcher program. Crossplatform. New program must be run with same java runtime what parent programm. E.g. system has two or more jre or no have installed jre (but have portable what run parent). I have one installed and one portable (just no have any info in system and work fine). Parent program run from portable and must run child program from same portable jre. Or another way, parent and child run on installed. Information about the portable only that the parent program runs from it. Its possible?

  • 2
    You can always make a system call to start another process, and that process can run another jvm. Or you start a thread that runs an arbitrary main method. Thus: your question is too broad. Consider focusing on smaller aspects so you can ask a more specific question. – GhostCat Jun 09 '19 at 11:07
  • Well, okay. How to get the path to jre that runs the main (parent) program? Information about it in the system may not be (as is the case with the portable jre). New program must be run "path to jre" + "java args" + "child programm args" –  Jun 09 '19 at 11:13
  • Just like my questions I did not find. Code like this reqied installed jre in system Runtime.getRuntime().exec("java -jar A.jar"); because part "java" dont know about portable jre. –  Jun 09 '19 at 11:36
  • 1
    [`System.getProperty("java.home")`](https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/lang/System.html#getProperties()) (follow link to see other available properties) – Slaw Jun 09 '19 at 11:43
  • Or as I told you: you arent the first one to ask this: https://stackoverflow.com/questions/3392416/determining-location-of-jvm-executable-during-runtime ... – GhostCat Jun 09 '19 at 11:52

0 Answers0