|
|
|
|
![]() ![]() |
Mar 1 2006, 09:15 PM
Post
#1
|
|
|
Advanced Member Group: Members Posts: 105 Joined: 22-December 05 Member No.: 10,229 |
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?
|
|
|
|
Mar 2 2006, 03:00 AM
Post
#2
|
|
|
Colonel Panic Group: [MODERATOR] Posts: 2,881 Joined: 25-March 05 From: Toronto, Ontario, Canada Member No.: 3,233 myCENTs:22.53 |
just make it a Java applet
CODE public class FirstApplet extends Applet implements ActionListener { where FirstApplet is the classname. xboxrulz |
|
|
|
Mar 12 2006, 12:38 PM
Post
#3
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 8 Joined: 12-March 06 Member No.: 11,920 myCENTs:28.63 |
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:
CODE public static void main(String args[]) to: CODE 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: CODE import javax.swing.*; // for JApplet and swing components import java.awt.event.*; // for ActionListener public class FirstApplet extends JApplet implements ActionListener { ... public void init() { ... your code here } } |
|
|
|
Mar 13 2006, 02:10 AM
Post
#4
|
|
|
Advanced Member Group: Members Posts: 105 Joined: 22-December 05 Member No.: 10,229 |
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. |
|
|
|
Mar 17 2006, 02:01 AM
Post
#5
|
|
|
Newbie [ Level 2 ] Group: Members Posts: 24 Joined: 10-February 06 Member No.: 11,194 |
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 |
|
|
|
Mar 20 2006, 07:23 PM
Post
#6
|
|
|
Advanced Member Group: Members Posts: 105 Joined: 22-December 05 Member No.: 10,229 |
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? CODE import javax.swing.*; // for JApplet and swing components import java.awt.event.*; // for ActionListener public 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(); } } This post has been edited by snutz411: Mar 20 2006, 07:29 PM |
|
|
|
Mar 20 2006, 07:51 PM
Post
#7
|
|
|
Advanced Member Group: Members Posts: 105 Joined: 22-December 05 Member No.: 10,229 |
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. |
|
|
|
May 8 2006, 10:38 PM
Post
#8
|
|
|
Advanced Member Group: Members Posts: 153 Joined: 8-May 06 From: Houston, TX Member No.: 13,291 |
Use Java Web Start
Has much better functionality then Applets. It can automatically upgrade client JRE. www.snakegame.i8.com Thats 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. |
|
|
|
May 8 2006, 11:41 PM
Post
#9
|
|
|
Premium Member Group: Members Posts: 200 Joined: 3-October 05 From: Missouri Member No.: 8,888 myCENTs:71.12 |
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. |
|
|
|
May 9 2006, 12:14 AM
Post
#10
|
|
|
Premium Member Group: Members Posts: 200 Joined: 3-October 05 From: Missouri Member No.: 8,888 myCENTs:71.12 |
<snip> CODE import javax.swing.*; // for JApplet and swing components import java.awt.event.*; // for ActionListener public 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? CODE 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. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 4th December 2008 - 11:13 PM |