943,846 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 2165
  • Java RSS
Apr 10th, 2009
0

exe java program by html link?

Expand Post »
my last thread was just solved that i can run my java programs in my linux box.

now i would love to know if some one knows how to make a html/xml page that has a link that if i clicked and it would execute my java program.

all i want to know is how to make the link works to exe the java program. a quick simple example would be great. Thanks very much
Similar Threads
k2k
Reputation Points: 15
Solved Threads: 1
Posting Whiz
k2k is offline Offline
351 posts
since Nov 2007
Apr 10th, 2009
0

Re: exe java program by html link?

You could have a hyperlink in an HTML page that links to another HTML page that contains a Java Applet. Not sure if that's what you are after though...
Reputation Points: 395
Solved Threads: 192
Veteran Poster
darkagn is offline Offline
1,136 posts
since Aug 2007
Apr 10th, 2009
0

Re: exe java program by html link?

Click to Expand / Collapse  Quote originally posted by darkagn ...
You could have a hyperlink in an HTML page that links to another HTML page that contains a Java Applet. Not sure if that's what you are after though...
sorry it is kinda unclear that what i was asking. after some googling, i found i might be able to do something like <applet code= xxx.class ... >

does it mean my java program must extend applet in order to put on the web?
k2k
Reputation Points: 15
Solved Threads: 1
Posting Whiz
k2k is offline Offline
351 posts
since Nov 2007
Apr 10th, 2009
0

Re: exe java program by html link?

For that to work, your program must extend Applet. Also note that in Applets there is no main method, the Applet's init, start and stop methods are called instead.

There are also java servlet pages that allow you to display HTML pages in your browser from within a Java program, but from your description it sounds like you want the opposite.

I am unaware of any other way to run a Java program from an HTML page, anyone else have any ideas?
Last edited by darkagn; Apr 10th, 2009 at 8:37 pm.
Reputation Points: 395
Solved Threads: 192
Veteran Poster
darkagn is offline Offline
1,136 posts
since Aug 2007
Apr 11th, 2009
0

Re: exe java program by html link?

well in ur java program u will have to write the following

Java Syntax (Toggle Plain Text)
  1. /* <applet code = "filename" height = 300 width = 300 >
  2.   </applet code> */

it should be written after the packages you import (i usually write at that position ). you can change height and width accordingly.
and you have to write like writing comments cuz java compiler doesnt understand that particular tagged code

and then save the file in .html form . i guess it should work
or else in the command mode you can use appletviewer
Last edited by rahul8590; Apr 11th, 2009 at 3:35 am.
Reputation Points: 92
Solved Threads: 20
Posting Whiz
rahul8590 is offline Offline
351 posts
since Mar 2009
Apr 11th, 2009
0

Re: exe java program by html link?

Yes I have already mentioned that k2k can run their program as an applet. Do you know of any way that a java application (ie not an applet) can be run from an HTML link?
Reputation Points: 395
Solved Threads: 192
Veteran Poster
darkagn is offline Offline
1,136 posts
since Aug 2007
Apr 12th, 2009
0

Re: exe java program by html link?

well in ur java program u will have to write the following

Help with Code Tags
(Toggle Plain Text)

/* <applet code = "filename" height = 300 width = 300 >
</applet code> */
***********************************************

does it mean my main html file should have a link, linking to another "html file in java format" and must extend to applet?

if it doesn't take too long, would you mind to give a simple example of the java program? maybe just the necessary heading and stuffs, so it would be easier for me to see the first time doing this.

thanks for all the contribution.
k2k
Reputation Points: 15
Solved Threads: 1
Posting Whiz
k2k is offline Offline
351 posts
since Nov 2007
Apr 13th, 2009
0

Re: exe java program by html link?

Quote ...
Yes I have already mentioned that k2k can run their program as an applet. Do you know of any way that a java application (ie not an applet) can be run from an HTML link?
well actually i used to convert all of my code in an applet form and work. but if u completely wanna run java application using html then try the underneath link .
http://www.java2html.com/
it converts the java code to html .


Quote ...
does it mean my main html file should have a link, linking to another "html file in java format" and must extend to applet?

if it doesn't take too long, would you mind to give a simple example of the java program? maybe just the necessary heading and stuffs, so it would be easier for me to see the first time doing this.
well i cannot write a complete program , but yeah since you have requested i can write a simple one.

Java Syntax (Toggle Plain Text)
  1. import java.awt.*;
  2. import java.applet.*;
  3. /* <applet code = "me" height = 300 width = 300 >
  4. </applet code> */
  5. public class me extends applet
  6. {
  7. public void paint (Graphics g)
  8. {
  9. g.drawString("hi",25,25);
  10. }
  11. }

well honestly i havent compiled the code , but to the best of my knowledge it must work .
Reputation Points: 92
Solved Threads: 20
Posting Whiz
rahul8590 is offline Offline
351 posts
since Mar 2009
Apr 13th, 2009
0

Re: exe java program by html link?

You could take a look at Web Start: http://java.sun.com/docs/books/tutor...art/index.html
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 839
Posting Genius
Ezzaral is offline Offline
6,761 posts
since May 2007
Apr 14th, 2009
0

Re: exe java program by html link?

that is very nice of all of you.

rahul8590, thanks for your example.
k2k
Reputation Points: 15
Solved Threads: 1
Posting Whiz
k2k is offline Offline
351 posts
since Nov 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: want make a jar file
Next Thread in Java Forum Timeline: value from from form to popup





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC