exe java program by html link?

Thread Solved

Join Date: Nov 2007
Posts: 227
Reputation: k2k is an unknown quantity at this point 
Solved Threads: 0
k2k k2k is offline Offline
Posting Whiz in Training

exe java program by html link?

 
0
  #1
Apr 10th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 793
Reputation: darkagn has a spectacular aura about darkagn has a spectacular aura about darkagn has a spectacular aura about 
Solved Threads: 110
darkagn's Avatar
darkagn darkagn is offline Offline
Master Poster

Re: exe java program by html link?

 
0
  #2
Apr 10th, 2009
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...
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 227
Reputation: k2k is an unknown quantity at this point 
Solved Threads: 0
k2k k2k is offline Offline
Posting Whiz in Training

Re: exe java program by html link?

 
0
  #3
Apr 10th, 2009
Originally Posted by darkagn View Post
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?
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 793
Reputation: darkagn has a spectacular aura about darkagn has a spectacular aura about darkagn has a spectacular aura about 
Solved Threads: 110
darkagn's Avatar
darkagn darkagn is offline Offline
Master Poster

Re: exe java program by html link?

 
0
  #4
Apr 10th, 2009
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.
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 210
Reputation: rahul8590 is on a distinguished road 
Solved Threads: 10
rahul8590's Avatar
rahul8590 rahul8590 is offline Offline
Posting Whiz in Training

Re: exe java program by html link?

 
0
  #5
Apr 11th, 2009
well in ur java program u will have to write the following

  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.
<?php
$data = $_POST['data'];
if(empty($data)) {
echo "byte me" ; }
?>
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 793
Reputation: darkagn has a spectacular aura about darkagn has a spectacular aura about darkagn has a spectacular aura about 
Solved Threads: 110
darkagn's Avatar
darkagn darkagn is offline Offline
Master Poster

Re: exe java program by html link?

 
0
  #6
Apr 11th, 2009
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?
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 227
Reputation: k2k is an unknown quantity at this point 
Solved Threads: 0
k2k k2k is offline Offline
Posting Whiz in Training

Re: exe java program by html link?

 
0
  #7
Apr 12th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 210
Reputation: rahul8590 is on a distinguished road 
Solved Threads: 10
rahul8590's Avatar
rahul8590 rahul8590 is offline Offline
Posting Whiz in Training

Re: exe java program by html link?

 
0
  #8
Apr 13th, 2009
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 .


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.

  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 .
<?php
$data = $_POST['data'];
if(empty($data)) {
echo "byte me" ; }
?>
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,439
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 510
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: exe java program by html link?

 
0
  #9
Apr 13th, 2009
You could take a look at Web Start: http://java.sun.com/docs/books/tutor...art/index.html
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 227
Reputation: k2k is an unknown quantity at this point 
Solved Threads: 0
k2k k2k is offline Offline
Posting Whiz in Training

Re: exe java program by html link?

 
0
  #10
Apr 14th, 2009
that is very nice of all of you.

rahul8590, thanks for your example.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC