The Artima Developer Community
Sponsored Link

Java Answers Forum
How do i start a bath file from a html page

6 replies on 1 page. Most recent reply: Sep 9, 2003 8:16 AM by Ram

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 6 replies on 1 page
Ram

Posts: 19
Nickname: srkothuru
Registered: Jul, 2003

How do i start a bath file from a html page Posted: Sep 5, 2003 8:55 AM
Reply to this message Reply
Advertisement
HI, i have a jar file. how do i start the jar file by cliking a link in a html page ( Both the jar and html are in the same folder and does not rewuire internet connection)

Can we start a .bat file from a html page.

Best Regards

Ram


David

Posts: 150
Nickname: archangel
Registered: Jul, 2003

Re: How do i start a bath file from a html page Posted: Sep 5, 2003 9:37 AM
Reply to this message Reply
What do you mean "start" a JAR? If the JAR is an applet, then all you have to do is include <applet> ... </applet> tags.

No, you can't directly run a .bat file from an HTML page.

Ram

Posts: 19
Nickname: srkothuru
Registered: Jul, 2003

Re: How do i start a bath file from a html page Posted: Sep 5, 2003 11:12 AM
Reply to this message Reply
> What do you mean "start" a JAR? If the JAR is an applet,
> then all you have to do is include <applet> ... </applet>
> tags.
>
> No, you can't directly run a .bat file from an HTML page.


I have a jar file with different java files in it as a package. If i double click on the "test.jar" or if i execute that command line "java -jar test.jar" , it works fine.

but i need to start the file from a html page with a link or a button that should execute the jar file. The reason i want this is, there are many files and the user doesnot know which one to use. ( all the files are on the same computer and no internet is required)

How do i do this??

Please help me.

Best Regards
Ram

David

Posts: 150
Nickname: archangel
Registered: Jul, 2003

Re: How do i start a bath file from a html page Posted: Sep 6, 2003 4:13 AM
Reply to this message Reply
> I have a jar file with different java files in it as a package. If i double click on the "test.jar" or if i execute that command line "java -jar test.jar" , it works fine.

OK. From the sounds of that, it's not an applet, it's a Java (probably Swing) application.

> but i need to start the file from a html page with a link or a button that should execute the jar file.

You can't simply click on a link and it will run. If you click on a link to a JAR, a dialog will be displayed asking the user whether they want to 'Save' or 'Open' the file. However, if the user selects 'Open' (and Java is installed on the local machine), the JAR will be executed. Here's the HTML I used in my test:

<html>
<body>
<a href="JDBA.jar"> Click here </a>
</body>
</html>


> The reason i want this is, there are many files and the user doesnot know which one to use. ( all the files are on the same computer and no internet is required)

Why not just organise your folder hierarchy better (or provide short-cuts at the top-level of the hierarchy tree)?

Ram

Posts: 19
Nickname: srkothuru
Registered: Jul, 2003

Re: How do i start a bath file from a html page Posted: Sep 8, 2003 1:09 PM
Reply to this message Reply
> You can't simply click on a link and it will run. If you
> click on a link to a JAR, a dialog will be displayed
> asking the user whether they want to 'Save' or 'Open' the
> file. However, if the user selects 'Open' (and Java is
> installed on the local machine), the JAR will be executed.
> Here's the HTML I used in my test:
>
> <html>
> <body>
> <a href="JDBA.jar"> Click here </a>
> </body>
> </html>
>

>

I did exactly the same thing as above. But after i opened the jar file nothing is displayed in the application. How can i track runtime errors to find out what went wrong??
Best regards

David

Posts: 150
Nickname: archangel
Registered: Jul, 2003

Re: How do i start a bath file from a html page Posted: Sep 9, 2003 12:31 AM
Reply to this message Reply
Is you application a Swing application (i.e. not an applet, but an application with a graphical front-end)?

If you saw nothing, I have a suspicion that your JAR contains a Java console application, in which case I don't think that you can do this. JAR files are typically opened with 'javaw' in windows, which suppresses the console. Therefore, if you try and run a JAR which contains a console application with 'javaw', all console input/output will be hidden!

You can check to see what kind of application your JAR is by simply double-clicking the JAR. If it appears that nothing happens, chances are that you've got a console application.

Ram

Posts: 19
Nickname: srkothuru
Registered: Jul, 2003

Re: How do i start a bath file from a html page Posted: Sep 9, 2003 8:16 AM
Reply to this message Reply
> Is you application a Swing application (i.e. not an
> applet, but an application with a graphical front-end)?
>
> If you saw nothing, I have a suspicion that your JAR
> contains a Java console application, in which case I don't
> think that you can do this. JAR files are typically
> opened with 'javaw' in windows, which suppresses the
> console. Therefore, if you try and run a JAR which
> contains a console application with 'javaw', all console
> input/output will be hidden!
>
> You can check to see what kind of application your JAR is
> by simply double-clicking the JAR. If it appears that
> nothing happens, chances are that you've got a console
> application.


My application is not a swing application. i am using jdk 1.1.7 so i cany use swings. WHen i double click the application worls fine. also it works when i say java -jar xyz.jar. But, it is not displaying anything when i gave the link in the html page.

Regards
Ram

Flat View: This topic has 6 replies on 1 page
Topic: =NullPointerException  with Compartor, help Previous Topic   Next Topic Topic: printing in Java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use