facebook

Applet CODEBASE

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #227550 Reply

    tadzio1
    Member

    Hi ,
    I do not know what should be CODEBASE in the HTML code, generated by a servlet for an applet, which is coded under MyEclipse in the MyProject/src in a default package.

    After deployment the class file of the applet is visible on a server ( like Tomcat 5 ) as:
    webapps/MyProject/WEB-INF/classes/MyApplet.class , but I cannot guess what CODEBASE in the HTML code should be.
    As an example consider the following code snippet of
    http://servlets.com/jservlet2/examples/ch10/ChatDispatch.java
    =========
    // Print the HTML code to generate the applet.
    // Choose the applet code based on the method parameter.
    // Provide a user parameter if we know the remote user.
    out.println(“<APPLET CODE=” + applet + ” CODEBASE=/ ” +
    “WIDTH=500 HEIGHT=170>”);
    ==========
    In the above snippet the command:
    ” CODEBASE=/ ” does not work
    and
    ” CODEBASE=WEB-INF/classes ”
    does not work – the applet is not loaded to the browser.
    I tried also simpler applets than HttpChatApplet ( of the above example) , but without success.
    Is it OK to keep the applet class file in the WEB-INF/classes , if not – where and how to put it ? And what about CODEBASE ?
    Tad

    #227570 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev, this is not an ME issue.

    Tad, CODEBASE is just where the applet code lives, and it *must* be in a publically accessible place. Anything under WEB-INF is actually protected by the app server and not publically accessible, so that won’t work. Try and put the class somewhere that you can actually hit the class file with your browser, once you’ve done that, just type in the whole path for the codebase, like:
    CODEBASE=http://www.mydomain.com/applet/code

    And then have your class files in the code directory.

    #227602 Reply

    tadzio1
    Member

    Thanks, Riyad
    Now it is clear. One more newbie question:
    Can I configure the build method – using only myEclipse menu – to automatically compile a selected source folder ( /applet_src ) to the /applet/code/applet.jar outside WEB-INF , as the regular src folder is automatically compiled inside WEB-INF .
    Of course I may do it using Ant, but … it is great in MyEclipse, that we do not need to use Ant !
    Tad

    #227604 Reply

    Riyad Kalla
    Member

    Can I configure the build method – using only myEclipse menu – to automatically compile a selected source folder ( /applet_src ) to the /applet/code/applet.jar outside WEB-INF , as the regular src folder is automatically compiled inside WEB-INF .

    I think you can also play with the File > Export > To JAR feature of Eclipse, that might do the trick too.

    #227616 Reply

    tadzio1
    Member

    Thanks for the trick.
    I found also that it makes more sense to keep all the “applet source” in a seperate Java (not WEB ) project, with an output to the jar file.
    Tad

    #282326 Reply

    dejan.ristov
    Member

    Hi,
    I have the same problem with the same class :
    http://servlets.com/jservlet2/examples/ch10/ChatDispatch.java

    Can you tell me what did you write in the CODEBASE parameter ?

    #291039 Reply

    amir55
    Participant

    hi Dear Riyad and all

    1 – I have my codebase in the jsp as to refer to java class in com.corejsf package

    I exported this class to a jar to place in the lib

    my jsp applet related source as next

    <jsp:plugin type=”applet” code=”English.class” codebase=”com/corejsf/” width=”475″ height=”350″>
    </jsp:plugin>

    so the question how to access this applet using he codebase ?

    2 – more to ask If I prefer NOT to keep the java applet in a jar so how to access it while Myeclipse automatically place classes in the WEB-INF ?

    many thanks
    Amir

    #316646 Reply

    amir55
    Participant

    hi again

    still no one has yet replied to my question to how to use the codebase in jsp to access the applet in side a pckage in the src

    thnaks allot

    Amir

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Applet CODEBASE

You must be logged in to post in the forum log in