I created the applet and added the necessary libraries. I tested the servlet as a standalone, and it works. I created the web app, and added the necessary libraries. This works fine with the test data. Using a test application, I can pass data between the applet and the servlet, and vice versa.
As per the directions (Test suite 3); 1. Create applet Java Class Library project which uses a library (NetBeans project or external JAR file) (Done) 2. Add library JAR file to the Applet library project classpath (Applet library project's Properties | Libraries panel) (Done) 3. Make sure that Build Required Projects is turned on in Applet library project's Properties | Libraries panel (Done) 4. Create Web application which packages applet (see previous scenario) 5. Package library into Web project: 1. Open Web project's Properties (project's context menu | Properties (Done) 2. Packaging panel | WAR Content | Add Project or Add JAR/Folder | browse library HelpLib project or JAR file (Done) 3. Set Path in WAR in WAR Content table to point besides Applet project/JAR file (I think this means to a point beside Applet project, anyway, I am unable to do this) 6. Build Applet project (Done) 7. Build Web project (Done)
In my .war file, I have the following structure: Jonsyn.war |--META-INF |--WEB-INF |--applet.jar |--commons-collections.jar |--jung-1-7.jar |--index.html
When I run the applet, the applet bombs because it can not find the resources it needs in the jung.jar. Which part of the instructions am I misunderstanding?
Joined: Mar 22, 2005
What does the HTML that contains the applet look like?
Also what does "Using a test application, I can pass data between the applet and the servlet, and vice versa." mean? Is this test applications another applet, or does it embed the applet somehow?
The code that calls my applet is this:[code] <APPLET code='applet.Applet_View' ARCHIVE='applet.jar' width=350 height=200> <PARAM NAME='attString' VALUE='urea'> </APPLET> [code]
What I meant by a test application was that I created a simple web application that passed a string from the applet to the servlet, and then passed an ArrayList back, so it didn't have any special dependencies. The 'real' application requires that the applet render a hyperbolic graph using the Jung (and several other libraries). I modeled my applet to servlet communication based on the examples here: http://www.frank-buss.de/echoservlet/ I compiled the applet and moved the class file to the web directory, and had it pass a String to the servlet. I did not create a test instance that embeds the applet in the web app as I intend to for the actual project. I actually had not thought of that until you asked about it. I'll try that and see what happens.
I created a test application in which the applet was packaged in the web application, and called from an html page, just like the production application should be. I added a couple of custom classes for the applet, and it was able to find them just fine. However, when I added the Jung package and did some drawing with it, it again couldn't find the necessary libraries. I suspect that there is something in my code that it doesn't like. I'm mystified why the applet would work as a stand-alone, but not when packaged in the web app. [ June 14, 2007: Message edited by: Chad Clites ]
Joined: Aug 16, 2005
Pardon the double post, but after looking through similar threads on umpteen forums, I still have not found the solution. It appears to me that my applet can not find the libraries that it needs to function. Indeed, when I look at the debugging information in Netbeans, it shows /Jonsyn/edu/uci/ics/jung/visualization/Layout.classas the request uri, and returns with a status of 404: Not Found.
I have checked the server, and all of the libraries have full permissions, so I am confident that it is not a permissions problem. What else am I missing at this point? The best I can tell, I have followed the directions to the letter.
Joined: Oct 06, 2006
Hi, I've built an applet too that uses jung and is embedded in "index.jsp" page. Perhaps you can help me with this:
MyApplet.java calls ReadData.java
ReadData reads in a .txt file located at "C:/Folder/hs_profile2dist.txt"
When my index.jsp is delopyed it should load MyApplet in a web page.
So, the problem i had was this : When deployed MyApplet CAN'T read hs_profile2dist.txt (C:/Folder/hs_profile2dist.txt)
So i put profile2dist.txt in the same folder as ReadData.java
Any tips about how to read my .txt file cause the sample below doesn't work!
As soon as the text file is read and used; the Applet "Should" use jung to graph some data.
If my jung graph works .......i'll gladly share my project file.
i use NetBeans too.
Joined: Aug 16, 2005
So let me see if I understand this. You hijack my thread with your largely unrelated question, and only offer to help me if I help you? Not only that, you don't bother letting us know what sort of errors you are getting.
That's rather rude, don't you think? [ June 16, 2007: Message edited by: Chad Clites ]
Next step, then, would be to repost your question as a new thread. Look around for the "Post New Topic" button. But first read our Applets FAQ to see if you see your question there.
Joined: Aug 16, 2005
Thanks Paul, that was the piece I was missing. After your post, I searched around in the applet documentation and found the following in the Jar Guide: During the execution of the applet, when a new class, image or audio clip is requested by the applet, it is searched for first in the archives associated with the applet.
The original snippet I found in the Applet Documentation states:You specify JAR files using the ARCHIVE attribute of the <APPLET> tag. You can specify multiple archive files by separating them with commas:
So I really was not looking in the correct spot for information. But it makes sense now. Another issue I had with this was the instructions for adding jar content to war content (Link given in my first post). The instruction Set Path in WAR in WAR Content table to point besides Applet project/JAR file threw me off. I thought at first it was supposed to say 'beside', but in reality it meant 'in a location other than the directory in which the Applet project/JAR file is located'.