7 Replies - 23631 Views - Last Post: 25 March 2012 - 04:23 PM

#1 andrew55  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 25-March 12

execute bat file from html page

Posted 25 March 2012 - 12:13 PM

I have a java program which was created for users to download from our website (as a zip) and then run from their computer (after it's unzipped). The program runs a simple audio exercise.

Currently, the program has to be run by clicking a bat file (start.bat) which is located inside the folder which contains the whole program.

Soon, the program will have different versions, all with different bat files that have to be clicked to execute each version (all in one big folder). Instead of users having to find the different bat files, I thought it would be great to have one html page that opens up locally with links to all of the different bat files. So when a use clicks on the link, it executes the bat file from the html page.

I have some experience with html and php, but have no clue how to execute a bat file form a html page. Is there a script I need to make this work? Any suggestions greatly appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: execute bat file from html page

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8325
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: execute bat file from html page

Posted 25 March 2012 - 12:36 PM

Has nothing to do with Java and if you think about an Applet, an Applet cannot access the local file system.
You would have better luck in the HTML forum

Howver, if you present your .ZIP in your .html file, the user can double click on it.
Was This Post Helpful? 0
  • +
  • -

#3 andrew55  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 25-March 12

Re: execute bat file from html page

Posted 25 March 2012 - 12:38 PM

Thank you. I just need to know how execute a bat file from a html page. Is there a way to move this topic to the html forum? Can I just repost the topic there?
Was This Post Helpful? 0
  • +
  • -

#4 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,277
  • Joined: 28-March 11

Re: execute bat file from html page

Posted 25 March 2012 - 01:26 PM

Er, can't you just use the URL markup?

<a href=start.bat>Start Me</a>

Just create a link for each batch file. You will be asked if you want to save or run the file when clicked though.

This post has been edited by GunnerInc: 25 March 2012 - 01:27 PM

Was This Post Helpful? 0
  • +
  • -

#5 andrew55  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 25-March 12

Re: execute bat file from html page

Posted 25 March 2012 - 02:01 PM

#4 GunnerInc,

I tried that at first and when the link is clicked, it shows a text string on page:

java -classpath ./classes/;./resources/;./lib/jl1.0.1.jar;./lib/mp3spi1.9.5.jar;./lib/tritonus_share.jar org.123.lmp.234.345.456 "./audios" "./configs" 1.0


This is why I posted this topic - in an attempt to find the correct way of getting the .bat to execute from a link or form submit button on a html (or php, etc) page
Was This Post Helpful? 0
  • +
  • -

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,437
  • Joined: 23-August 08

Re: execute bat file from html page

Posted 25 March 2012 - 04:04 PM

Maybe Java Web Start is what you want, but you should NOT be able to do what you're asking. That's a security nightmare (q.v., ActiveX).
Was This Post Helpful? 0
  • +
  • -

#7 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,277
  • Joined: 28-March 11

Re: execute bat file from html page

Posted 25 March 2012 - 04:12 PM

From my understanding of the OP, his users download a zip to their computer then unzip to a directory then his Java program gets started by using a batch file. Soon there will be many version with many batch files?

Why don't you just create a "Loader"? User runs this program and is presented with choices of which java program to start. Once selected, pass the correct params to the Java exe.
Was This Post Helpful? 0
  • +
  • -

#8 andrew55  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 25-March 12

Re: execute bat file from html page

Posted 25 March 2012 - 04:23 PM

GunnerInc - Yes, it would be something than is downloaded to the users computer first.

I was going with a simple html file (with php, or whatever else it needs) just because it seemed to be a simple approach. I have no experience with loaders and wouldn't know where to start. Although, if it's not that complicated, I do have some coding experience and might be able to figure it out - if I know where to start.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1