snutz411 0 Report post Posted March 1, 2006 I have this Java Application that is already coded which interacts with a database. Is there any way that would be easy enough to launch this application via a local intranet? It is not in any Applet package, but I do have the JARs. Can this be done without too much effort? Share this post Link to post Share on other sites
xboxrulz1405241485 0 Report post Posted March 2, 2006 just make it a Java applet public class FirstApplet extends Applet implements ActionListener { where FirstApplet is the classname.xboxrulz Share this post Link to post Share on other sites
viterbi209 0 Report post Posted March 12, 2006 Just like xboxrulz says, make it into an applet and the only other thing you would probably have to change would be the initial entry point into your code from: public static void main(String args[]) to:public void init() also the class you need to import would be java.applet.Applet. An alteranative would be to use java's swing components and for this you would import javax.swing.* and extend JApplet instead of Applet. The initial entry point into your code is still the same. So the code would look like this:import javax.swing.*; // for JApplet and swing componentsimport java.awt.event.*; // for ActionListenerpublic class FirstApplet extends JApplet implements ActionListener{ ... public void init() { ... your code here }} Share this post Link to post Share on other sites
snutz411 0 Report post Posted March 13, 2006 Thanks for the suggestions. I still have some tweaks to figure out in my program, then I'll start trying to turn it into a Web App. The thing is I only have a couple more weeks left at my job because its just an internship. So either it turns into a Web App or I'll just throw an executable on the intranet site.I'd only have to fool around with the main file because its only a one liner which calls another class which does all the work. Share this post Link to post Share on other sites
uapconsole 0 Report post Posted March 17, 2006 Perhaps this is stating the obvious: have you considered Java Networking Launching Protocol or JNLP. However, it is now commonly referred to as Java Web Start. The protocol instructions are simply XML files. Good luck, follow this referrence: https://en.wikipedia.org/wiki/JNLP- Demirelli Share this post Link to post Share on other sites
snutz411 0 Report post Posted March 20, 2006 (edited) Here's what my Main.java file looks like right now. It used to be just a one liner that called another class which did all the work. When I launch this through my web browser I'm getting an NoClassDef Error.Also if I am creating an Applet using Eclipse as my IDE can I still compile it and launch the program from there as if it were a normal application? import javax.swing.*; // for JApplet and swing componentsimport java.awt.event.*; // for ActionListenerpublic class Main extends JApplet implements ActionListener { public void actionPerformed(ActionEvent e) { init(); } public void init() { // Launch Tracking_GUI Tracking_GUI window = new Tracking_GUI(); window.show(); }} Edited March 20, 2006 by snutz411 (see edit history) Share this post Link to post Share on other sites
snutz411 0 Report post Posted March 20, 2006 Perhaps this is stating the obvious: have you considered Java Networking Launching Protocol or JNLP. However, it is now commonly referred to as Java Web Start. The protocol instructions are simply XML files. Good luck, follow this referrence: http://en.wikipedia.org/wiki/JNLP- Demirelli That's an option, but I would also have to make sure each computer has Java Web Start installed on it which is separate from the basic Java Runtime Environment. Share this post Link to post Share on other sites
BitShift 0 Report post Posted May 8, 2006 Use Java Web StartHas much better functionality then Applets.It can automatically upgrade client JRE.http://forums.xisto.com/no_longer_exists/ for my snake game, the second link uses Java Web Start. Take a look at the JNLP format it uses, you can pretty much copy and paste.Just open the .jnlp file in notepad.It has an extremely slow launch process though, but its a Java app so it will be slow anyways. Share this post Link to post Share on other sites
evought 0 Report post Posted May 8, 2006 Thanks for the suggestions. I still have some tweaks to figure out in my program, then I'll start trying to turn it into a Web App. The thing is I only have a couple more weeks left at my job because its just an internship. So either it turns into a Web App or I'll just throw an executable on the intranet site.I'd only have to fool around with the main file because its only a one liner which calls another class which does all the work. That's the best case to work with. It is really easy then to leave the Main file intact and add an Applet class to the jar. The jar will work as either an applet or standalone depneding on how it is called. The Applet class file, like your main file, will contain very little.Hopefully, your current Main file creates a toplevel frame and passes it to the class which does all of the work. In that case, you can create your applet and pass the Applet's Frame in instead. If not (if the inernal class creates a top-level frame), then it will take some more work to fix. At that point, post some snippets and I am sure people will help you out. Share this post Link to post Share on other sites
evought 0 Report post Posted May 9, 2006 <snip> import javax.swing.*; // for JApplet and swing componentsimport java.awt.event.*; // for ActionListenerpublic class Main extends JApplet implements ActionListener { public void actionPerformed(ActionEvent e) { init(); } public void init() { // Launch Tracking_GUI Tracking_GUI window = new Tracking_GUI(); window.show(); }} OK, here is what I was mentioning with Frames and such. Here, you create a separate window from your applet. This is often considered poor form (people hate popups). It is often better to display your GUI within the Applet. JApplet has a getContentPane() method which returns a Container, You can modify Tracking_GUI to provide a new constructor which takes a Container as an argument. Everything in the Tracking_GUI gets packed into that Container. Your Tracking_GUI() constructor just creates a new Window and then passes *that* Container to the method which creates the widgets. Make sense?public Tracking_GUI(Container c){ Create_GUI(c);}public Tracking_GUI(){ my_frame = new JFrame("Tracking GUI"); Create_GUI(my_frame.getContentPane());}public void Create_GUI(Container c){ my_container = c; // Create widgets and add them to my_container JLable l = new JLabel ("foo"); my_container.add (l); // etc.} Anyway, this is the kind of thing I have doen in the past. It makes it possible to run the same code as a standalone app, an applet, or even embedded in another application without a lot of fuss and bother.Your Applet calls Tracker_GUI(getContentPane()) and your main calls TrackerGUI().If this does not make any sense at all, I am probably over-tired and will try again later. Share this post Link to post Share on other sites
Jof33z 0 Report post Posted June 1, 2006 public class FirstApplet extends JApplet implements ActionListener{ and I belive you may need some imports, maby io :s for further down the track. Share this post Link to post Share on other sites
BitShift 0 Report post Posted June 2, 2006 public class FirstApplet extends JApplet implements ActionListener{ and I belive you may need some imports, maby io :s for further down the track. yea you need these imports already for this:import javax.swing.*;import java.applet.*;import java.awt.*;import java.awt.event.*; yea basic io import isimport java.io.*; and of course you probably ganna need the utility at some pointimport java.util.*; Share this post Link to post Share on other sites
BitShift 0 Report post Posted June 15, 2006 That's an option, but I would also have to make sure each computer has Java Web Start installed on it which is separate from the basic Java Runtime Environment. No Java Web Start does not have to be installed on people's compturers.The Web Server you have the file on just has to be configured to handle the file properly.The way it works is it downloads and executes your JARS to the users computer.All they need is a compatitble JRE for your program. Share this post Link to post Share on other sites