-1

I am creating one bat file, like internet.bat.

This is my bat file data.

    set class = java instalation path in my local    
    java AddTrustedSite

    java DisablePopup 

pause

Now I want to fetch java installation path dynamically using java in my local.

Tom Sebastian
  • 3,373
  • 5
  • 29
  • 54
jyothi
  • 1
  • 1
  • And why do you want that? Isn't that enough that you can run your programs? – fge Dec 01 '15 at 09:07
  • this is my requirement.If any one run this bat file along with my java files(AddTrustedSite,DisablePopup ) it should be run. – jyothi Dec 01 '15 at 09:15
  • Trouble is that a system can easily have multiple Java runtimes installed. There is no "the java installation path" to speak of. – Gimby Dec 01 '15 at 09:18
  • 3
    better to rely on environment variable `JAVA_HOME` – Tom Sebastian Dec 01 '15 at 09:20

1 Answers1

2

You can use the following command in Windows,

where java

  • 2
    "where java" I guess .. C:\Users\user>where javac INFO: Could not find files for the given pattern(s). C:\Users\user>where java C:\ProgramData\Oracle\Java\javapath\java.exe C:\Windows\System32\java.exe – xxxvodnikxxx Dec 01 '15 at 09:21
  • Btw @jyothi for running command line commands through java look eg. there (maybe you will find something better) http://stackoverflow.com/questions/4157303/how-to-execute-cmd-commands-via-java – xxxvodnikxxx Dec 01 '15 at 09:33