• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

What Am I doing wrong with my codebase?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I want to invoke an Applet from a jsp file.here is the jsp plugin I have used :

<jsp:plugin type="applet"
code="pk1/MyApplet.class" codebase="/AppletTest/src/pk1"
width="1400" height="800">
</jsp:plugin>

where AppletTest is my Dynamic web project.The jsp file is kept in WebContent folder and and MyApplet.java is stored in pk1 package.so could you please tell me whats wrong with my codbase??
 
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For starters, the code attribute takes a class name, not a file name. Class names contain dots, whereas file names contains slashes.

The codebase attribute should contain the root of the class directory hierarchy - that means it should not contain the package name. Also, does the "src" directory really contain class files? That sounds counter-intuitive.
 
Shamim Emon
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.I was wrong about "src" directory.I am still unable to get the applet.If I understand you clearly then the code attribute should contain only class name even if it is in a pakage?like code="MyApplet.class"
also if the correct directory is "AppletTest\build\classes\pk1"where pk1 is the package name then codebase="/AppletTest/build/classes/" right? Still cant find the applet.So far I am only able to get the applet only when I make a jar file which is in the same directory as the jsp file by archile="somename.jar". Its kind of eating me why can't I do it with the code base .Some more help would be really appreciated.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the layout of your files and directories? What is the error you get in the Java Console?
 
Shamim Emon
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I get class not found exception.And,here is the layout of my flies:
AppletTest(Web dynamic project).There I have the package"pk1"which contrains the appletcode"MyApplet.Java"
"WebContent" folder contains the jsp file which contains the the code fragment I paste above.
Thanks once again
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where the source file is is irrelevant - it's not used at runtime. Important is where the class file(s) is.

What HTML does get created by that JSP tag? Also, post the entire stack trace.

To make things easy you may wish to start out simple - don't use codebase, and instead keep the files in the same directory - meaning, the "pk1" directory should be in the same place as the JSP file.

Also, are you accessing the JSP directly? It gets more complicated if you hide it behind a servlet, because then the URL has no resemblance to the directory structure.

Lastly, try relative paths in the JSP tag. I'm not sure if absolute paths are supposed to work.
 
Yeah. What he said. Totally. Wait. What? Sorry, I was looking at this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic