I have created a java app that will discover all the files in a folder and tell me which one is the newest. How can I make a web page run the java app and display a link to the newest file on the web page?
Thanks,
David
Integrate Java Application with HTML page
Page 1 of 17 Replies - 763 Views - Last Post: 04 July 2012 - 11:23 AM
Replies To: Integrate Java Application with HTML page
#2
Re: Integrate Java Application with HTML page
Posted 26 June 2012 - 10:34 PM
isn’t client side Java done through Applets?
#3
Re: Integrate Java Application with HTML page
Posted 27 June 2012 - 05:16 AM
#4
Re: Integrate Java Application with HTML page
Posted 27 June 2012 - 06:11 AM
don’t know myself, but the guys in the Java forum should know.
#5
Re: Integrate Java Application with HTML page
Posted 27 June 2012 - 06:57 AM
Here is the basic stuff to set up an applet.
Then you just have to embed that into the page.
// <applet code="Sketcher" width="300" height="300"></applet>
// use: prompt>appletviewer Sketcher.java
import java.awt.*;
import javax.swing.*;
public class Sketcher extends JApplet {
public static void main(String[] args) {
JApplet applet = new Sketcher();
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(applet);
f.setSize(300,200);
f.setLocation(100,100);
applet.init();
f.setVisible(true);
}
public void init() {
JMenuBar menuBar = new SketchFrame("").getJMenuBar();
setJMenuBar(menuBar);
}
}
Then you just have to embed that into the page.
#6
Re: Integrate Java Application with HTML page
Posted 01 July 2012 - 11:55 AM
denting5, on 27 June 2012 - 06:57 AM, said:
Here is the basic stuff to set up an applet.
Then you just have to embed that into the page.
// <applet code="Sketcher" width="300" height="300"></applet>
// use: prompt>appletviewer Sketcher.java
import java.awt.*;
import javax.swing.*;
public class Sketcher extends JApplet {
public static void main(String[] args) {
JApplet applet = new Sketcher();
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(applet);
f.setSize(300,200);
f.setLocation(100,100);
applet.init();
f.setVisible(true);
}
public void init() {
JMenuBar menuBar = new SketchFrame("").getJMenuBar();
setJMenuBar(menuBar);
}
}
Then you just have to embed that into the page.
Thank you for that. Since I do not need a GUI, I decided to just add "extends Applet" to my class name, but I have not had much success so far. Then I referenced the program from one of my html page as <applet code='FirstApplet.class'> </applet>. Opening the html page should cause my applet to start and open the most recent file in the directory I used, but nothing seems to be happening. Anything else I should try to get it to work?
#7
Re: Integrate Java Application with HTML page
Posted 01 July 2012 - 12:20 PM
You can have an Applet and Application at the same time with this code snippet from pbl:
http://www.dreaminco...snippet4467.htm
http://www.dreaminco...snippet4467.htm
#8
Re: Integrate Java Application with HTML page
Posted 04 July 2012 - 11:23 AM
In case anyone in the future may want to know, I figured out the best way to approach this is to create a Java Web Start. Overall it seems pretty simple except the JNLP page that has to be set up. I decided against using an applet because it's tricky to allow it access to a user's local file directories. Thank you guys for the help.
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote







|