- This topic has 1 reply, 2 voices, and was last updated 19 years, 6 months ago by Riyad Kalla.
-
AuthorPosts
-
ChaoticAnomalyMemberHeya guys, this is my first time posting so be gentle ;D.
I’m fairly new to designing in the eclipse environment, i recently aquired a job and it is their primary IDE so I figured I would start using it at home also. Sorry if this is a dumb question, and if this is the wrong section, but I’m getting really frustrated over a simple thing and for the life of me I can’t seem to find the answer anywhere.
On to the question:I’m designing an applet and a servlet that communicate between eachother through HTTP protocols. When I create an applet through myeclipse it goes through the wizard, and puts my applet class in the src folder in its own package, which is the way I want it. But the html file it generates and the code that is supposed to connect to the applet doesn’t work.
If I try to force it to put the file elsewhere, for some reason it won’t generate a .class file. I’ve been wondering if there is a way I can tweak the web.xml to redirect to the applet like it does for the servlet, but I haven’t found anything to suggest that.
Is this just a fault in myeclipse that my html file that is generated can’t seem to find my applet? Or am I doing something wrong or just thinking about this in the wrong mindset? I can create the applet file in textpad and compile it, then copy/paste the class file in the folder with the html file and that works fine, but that seems like something I shouldn’t have to do.
Thanks in advance for any help =)
Riyad KallaMemberMoving to OT > Soft Dev.
I think this might be a problem of mentally organizing the project… MyEclipse is primarily a J2EE IDE, so Applets are not a huge part of our customer base. The problem here is that with an Applet you need to keep your code files in a publically accessible place so the HTML file can find them and the browser can stream them down to the client. This means that using the typical layout of a Web Project won’t work because the output directory is typically WebRoot/WEB-INF/classes, and according to webspec everything under WEB-INF is protected by the app server from being publically accessed, which means you HTML (or JSP) file hosting the applet, will not be able to access your class.
This is what I would suggest, 2 projects!
1) Java Project, this is your Applet, the entire project is JUST your Applet.
2) Web Project, this is your HTML page serving up the applet as well as your servlet.What you want to do is make an Ant script for Project #1 that JARs the whole thing up into a single JAR, then you take that JAR and put it into your Project #2 in the WebRoot folder somewhere, maybe under WebRoot/jars or something, then in your HTML file you have “codebase=jars/MyApplet.jar” or something like that.
This way the structure and layout of each project can stay “pure” and you don’t have to break your own back trying to get them to play nice in a single project.
-
AuthorPosts