JAR! . . .What is it good for?. . .Absolutely nothing :-)

Discussion in 'Java' started by Oliver Wong, Dec 12, 2006.

  1. Oliver Wong

    Oliver Wong Guest

    "Richard Maher" <> wrote in message
    news:elmcoe$lor$...
    > Hi,
    >
    > Well not quite; actually love JAR files, but why does the AppletViewer
    > (W2K
    > SUN JDK "something", at least) insist on asking for the .CLASS file *as
    > well
    > as* the .JAR file?
    >
    > Is this *all* applet viewers? *all* html? or just something *my* code is
    > doing?


    If I understand your complaint correctly, it's not all applet viewers:
    mine doesn't additionally ask for a JAR file when I provide it a CLASS file
    nor vice versa. I can't imagine how HTML or the Java source code itself
    might trigger this behaviour in your applet viewer program, so I'd have to
    say "no" to your other 2 questions as well.

    >
    > Also why are there no hits on "noclassdeffounderror" on SUN's website?


    I believe Roedy's site, mindprod.com, has a good overview of what to do
    when you encounter a NoClassDefFoundError.
    http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR

    >
    > In the attached *very short* code snippet, the EmpApplet class is
    > attempting
    > to invoke methods in the EmpClient class that has been built into the same
    > JAR file, but the only Typing that I can see (sorry not my code, but I'm
    > told this works on UNIX browsers) is: -
    >
    > EmpClient client;


    I've never heard the term "Typing" before. Based on context, I'm
    guessing you're referring to the *declaration* of "client" as being of type
    EmpClient.

    >
    > I'm guessing that this declares "client" as an instance of the EmpClient
    > class, but doesn't EmpClient have to be Imported or something?


    In your code (which I've snipped), both classes are in the same package
    (which happens to be the default, nameless package). Classes which are in
    the same package don't need to import one another to be visible to one
    another. Note that it's generally considered bad practice to use the default
    package. Recommended practice is to put classes in a package whose name is
    based on a domain name which you own (this is sort of to provide globally
    unique package names). So if you own "google.com", you could call your
    package "com.google.mypackage", for example.

    > Either way,
    > EmpClient is not "inited" and the -debug gives me the noclassdeffounderror
    > and the browser makes no attempt to load EmpClient from the codebase.
    >
    > So, how does one define a class? import?


    The problem here isn't that the class isn't defined, but rather that it
    class definition could not be found. Check out Roedy's recommendation on
    fixing this (the URL again is
    http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR), but
    be warned that this is one of the trickier problems to try to fix.

    - Oliver
     
    Oliver Wong, Dec 12, 2006
    #1
    1. Advertising

  2. Hi,

    Well not quite; actually love JAR files, but why does the AppletViewer (W2K
    SUN JDK "something", at least) insist on asking for the .CLASS file *as well
    as* the .JAR file?

    Is this *all* applet viewers? *all* html? or just something *my* code is
    doing?

    Also why are there no hits on "noclassdeffounderror" on SUN's website?

    In the attached *very short* code snippet, the EmpApplet class is attempting
    to invoke methods in the EmpClient class that has been built into the same
    JAR file, but the only Typing that I can see (sorry not my code, but I'm
    told this works on UNIX browsers) is: -

    EmpClient client;

    I'm guessing that this declares "client" as an instance of the EmpClient
    class, but doesn't EmpClient have to be Imported or something? Either way,
    EmpClient is not "inited" and the -debug gives me the noclassdeffounderror
    and the browser makes no attempt to load EmpClient from the codebase.

    So, how does one define a class? import?

    Yes, I will google tomorrow but it's late and I'm old. . .

    Regards Richard Maher

    PS. Sorry for the school boy questions, but I honestly am RTFMing as well.

    EmpClient Class
    ===========

    import java.io.BufferedOutputStream;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io_OutputStream;
    import java.net.InetAddress;
    import java.net.Socket;
    import java.net.UnknownHostException;


    public class EmpClient {
    public static final String HOSTCHARSET="ISO-8859-1";
    public static final byte [] CRLF = {'\r','\n'};
    private Socket socket;
    private String host;
    private int port;
    private BufferedReader in;
    private OutputStream out;

    public class Message
    {
    String type;
    String message;
    Message (String type , String message)
    {
    this.type = type;
    this.message = message;
    }
    public String getMessage()
    {
    return message;
    }
    public String getType()
    {
    return type;
    }

    }
    EmpClient (String host , int port)
    {
    this.host = host;
    this.port = port;
    }

    public void open () throws UnknownHostException, IOException
    {
    socket = new Socket (InetAddress.getByName(host) , port);
    in = new BufferedReader (new InputStreamReader (socket.getInputStream() ,
    HOSTCHARSET));
    out = new BufferedOutputStream (socket.getOutputStream());
    }

    public void close () throws IOException
    {
    try {
    sendMessage ("99","");
    } catch (IOException e) {
    // close in any situation!
    }
    socket.close();
    }

    public void sendMessage (String type , String message) throws IOException
    {
    byte [] msgtype = type.getBytes(HOSTCHARSET);
    byte [] msg = message.getBytes(HOSTCHARSET);

    out.write(msgtype);
    out.write(msg);
    out.write(CRLF);
    out.flush();
    }
    public Message readMessage () throws IOException
    {
    String wholemsg = in.readLine();

    String type = wholemsg.substring(0,2);
    String msg = wholemsg.substring(2);
    return new Message (type , msg);
    }
    public void initEmployeeRead (String employee) throws IOException
    {
    sendMessage ("20" , employee);
    }
    public String readNextEmployee () throws IOException
    {
    Message msg = readMessage ();
    if (msg.getType().equals("21"))
    return msg.getMessage().trim();
    return null;
    }
    }

    EmpApplet Class
    ============

    import java.applet.Applet;
    import java.io.IOException;


    public class EmpApplet extends Applet {
    EmpClient client;

    public void init ()
    {
    String host = getParameter("HOST");
    int port = Integer.parseInt(getParameter ("PORT"));
    client = new EmpClient (host , port);
    try {
    client.open();
    } catch (Exception e) {
    client = null;
    }
    }
    public String initEmployee (String employee)
    {
    try {
    client.initEmployeeRead(employee);
    return null;
    } catch (IOException e) {
    return e.getMessage();
    }
    }
    public String nextEmployee ()
    {
    try {
    return client.readNextEmployee();
    } catch (IOException e) {
    return null;
    }
    }
    public void destroy() {
    try {
    client.close();
    } catch (IOException e) {
    }
    super.destroy();
    }
    }
     
    Richard Maher, Dec 12, 2006
    #2
    1. Advertising

  3. Richard Maher wrote:
    > Hi,


    Please refrain from multi-posting, as well as using
    'cute' titles, in future.

    (X-post to c.l.j.p./comp.os.vms, w/ f/u to c.l.j.p. only)

    Andrew T.
     
    Andrew Thompson, Dec 12, 2006
    #3
  4. Oliver Wong

    Lew Guest

    Andrew Thompson wrote:
    > Richard Maher wrote:
    >> Hi,

    >
    > Please refrain from multi-posting, as well as using
    > 'cute' titles, in future.
    >
    > (X-post to c.l.j.p./comp.os.vms, w/ f/u to c.l.j.p. only)
    >
    > Andrew T.


    Sorry to disagree, since most always I am with you on the Netiquette
    reminders, but I recommend we not suppress 'cute' titles per se. However, to
    the OP, if you give a hint as to the actual problem in the title that will
    help you get better answers.

    If you can do that and still be cute, more power to ye, but most likely you
    will find that informative will preclude and trump cute.

    - Lew
     
    Lew, Dec 12, 2006
    #4
  5. Lew wrote:
    > Andrew Thompson wrote:
    > > Richard Maher wrote:
    > >> Hi,

    > >
    > > Please refrain from ... using 'cute' titles, in future.

    ...
    > Sorry to disagree,


    No need for apologies..

    >...since most always I am with you on the Netiquette
    > reminders, but I recommend we not suppress 'cute' titles per se.


    (shrugs) It is not a c.l.j.p. 'policy', nor even my
    policy, as such. I would not mention it if that
    was the only thing I had to say, but if I am
    replying, I will mention it the way I did, and
    leave it to the OP's initiative to follow it up..
    (but yes, the reasons you mentioned are basically
    why I advised against it)

    Andrew T.
     
    Andrew Thompson, Dec 12, 2006
    #5
  6. Hi Oliver,

    Thanks for your detailed reply, and your patience.

    "Oliver Wong" <> wrote in message
    news:eek:xzfh.22160$...
    > I can't imagine how HTML or the Java source code itself
    > might trigger this behaviour in your applet viewer program,


    It ended up pilot error :-( I looked through the JAR manifest and to my
    embarassment I found the EmpApplet and EmpClient classes but sadly no
    EmpClient$Message class. Looks like a simple build error; sorry.

    I am now getting the, equally lovely, "Incompatible magic value" error :-(
    I'm guessing that it's because I'm running the latest and greatest 1.6 JDK
    and the JVM on W2K won't work with that (I have run windows update; is there
    a seperate JVM download site?) Anyway I have a 1.4.2 JDK on a Windows98 box
    that I'll use to build the classes and the Jar and see if that makes a
    difference.

    > I believe Roedy's site, mindprod.com, has a good overview of what to

    do
    > when you encounter a NoClassDefFoundError.
    > http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR


    Good pointer! I think I'll have need of that in the future :-(

    > I've never heard the term "Typing" before. Based on context, I'm
    > guessing you're referring to the *declaration* of "client" as being of

    type
    > EmpClient.


    May be useful to think of my use of Java and OO terminology as analogous the
    Policeman's French accent from the Television series 'allo 'allo. I'm
    struggling but you get the general gist of what I'm talking about :)

    > In your code (which I've snipped), both classes are in the same

    package
    > (which happens to be the default, nameless package). Classes which are in
    > the same package don't need to import one another to be visible to one
    > another. Note that it's generally considered bad practice to use the

    default
    > package. Recommended practice is to put classes in a package whose name is
    > based on a domain name which you own (this is sort of to provide globally
    > unique package names). So if you own "google.com", you could call your
    > package "com.google.mypackage", for example.


    Good tip! Taken on board.

    Thanks again.

    Cheers Richard Maher

    "Oliver Wong" <> wrote in message
    news:eek:xzfh.22160$...
    >
    > "Richard Maher" <> wrote in message
    > news:elmcoe$lor$...
    > > Hi,
    > >
    > > Well not quite; actually love JAR files, but why does the AppletViewer
    > > (W2K
    > > SUN JDK "something", at least) insist on asking for the .CLASS file *as
    > > well
    > > as* the .JAR file?
    > >
    > > Is this *all* applet viewers? *all* html? or just something *my* code

    is
    > > doing?

    >
    > If I understand your complaint correctly, it's not all applet viewers:
    > mine doesn't additionally ask for a JAR file when I provide it a CLASS

    file
    > nor vice versa. I can't imagine how HTML or the Java source code itself
    > might trigger this behaviour in your applet viewer program, so I'd have to
    > say "no" to your other 2 questions as well.
    >
    > >
    > > Also why are there no hits on "noclassdeffounderror" on SUN's website?

    >
    > I believe Roedy's site, mindprod.com, has a good overview of what to

    do
    > when you encounter a NoClassDefFoundError.
    > http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR
    >
    > >
    > > In the attached *very short* code snippet, the EmpApplet class is
    > > attempting
    > > to invoke methods in the EmpClient class that has been built into the

    same
    > > JAR file, but the only Typing that I can see (sorry not my code, but I'm
    > > told this works on UNIX browsers) is: -
    > >
    > > EmpClient client;

    >
    > I've never heard the term "Typing" before. Based on context, I'm
    > guessing you're referring to the *declaration* of "client" as being of

    type
    > EmpClient.
    >
    > >
    > > I'm guessing that this declares "client" as an instance of the EmpClient
    > > class, but doesn't EmpClient have to be Imported or something?

    >
    > In your code (which I've snipped), both classes are in the same

    package
    > (which happens to be the default, nameless package). Classes which are in
    > the same package don't need to import one another to be visible to one
    > another. Note that it's generally considered bad practice to use the

    default
    > package. Recommended practice is to put classes in a package whose name is
    > based on a domain name which you own (this is sort of to provide globally
    > unique package names). So if you own "google.com", you could call your
    > package "com.google.mypackage", for example.
    >
    > > Either way,
    > > EmpClient is not "inited" and the -debug gives me the

    noclassdeffounderror
    > > and the browser makes no attempt to load EmpClient from the codebase.
    > >
    > > So, how does one define a class? import?

    >
    > The problem here isn't that the class isn't defined, but rather that

    it
    > class definition could not be found. Check out Roedy's recommendation on
    > fixing this (the URL again is
    > http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR),

    but
    > be warned that this is one of the trickier problems to try to fix.
    >
    > - Oliver
    >
    >
     
    Richard Maher, Dec 14, 2006
    #6
  7. Oliver Wong

    Oliver Wong Guest

    "Richard Maher" <> wrote in message
    news:elrds3$3b4$...
    >
    > I am now getting the, equally lovely, "Incompatible magic value" error :-(
    > I'm guessing that it's because I'm running the latest and greatest 1.6 JDK
    > and the JVM on W2K won't work with that (I have run windows update; is
    > there
    > a seperate JVM download site?) Anyway I have a 1.4.2 JDK on a Windows98
    > box
    > that I'll use to build the classes and the Jar and see if that makes a
    > difference.


    Java 1.6 (AKA Java 6, Sun gives a lot of confusing aliases to their
    version numbering system) just got officially released a few days ago (it
    was previously in beta). You can download the JVM from
    http://java.sun.com/javase/downloads/index.jsp

    - Oliver
     
    Oliver Wong, Dec 14, 2006
    #7
  8. Hi Oliver

    Thanks for the reply.

    "Oliver Wong" <> wrote in message
    news:u9egh.5491$...
    > Java 1.6 (AKA Java 6, Sun gives a lot of confusing aliases to their
    > version numbering system) just got officially released a few days ago (it
    > was previously in beta). You can download the JVM from
    > http://java.sun.com/javase/downloads/index.jsp


    I downloaded that version and it certainly progressed things a bit but I'm
    still floundering. I'm gonna be a bit contemptuous here and cut and paste a
    request I sent to another bloke that's helping me, but if you could have a
    quick glance over the versions at least (if nothing else) and let me know if
    anything stands out (like the Object tag is dodgy) I'd really appreciate it!

    Regards Richard Maher

    I'm dying here!

    I know you've held my hand and spoon fed me and if I can't tie my own shoe
    laces by now then there's no help for me, but *please* look at what I have
    done and tell me what I'm doing wrong!

    This is Windows 2000 5.00.2195 SP 4 and iexplore 6.0.2800.1106 SUN JDK 1.6.0
    (Latest Not beta)

    Javac EmpClient.java
    Javac EmpApplet.java

    /* Maybe I should use the -g switch for debug info as I no longer seem to be
    able to "stop at EmpApplet:1" in the Appletviewer anymore and the class and
    archive files seem smaller. */

    Jar -cf emp.jar EmpApplet.class EmpClient.class EmpClient$Message.class

    Jar -tf emp.jar

    // Looks good 3115 bytes for emp.jar

    FTP to VMS box 1.2.3.6 type=image

    $set file/attr=(rfm:udf) emp.jar

    *NOW* If I use the <Applet> tag I get the classnotfound error and the reason
    is "socket error unexpected end of file" but I have sent 3115 bytes with
    your VMS COPY.

    So I give up on the applet tag and move to the <OBJECT> tag but I can't find
    a useful syntax diagram on the web and certainly not one with your
    "verbs/attributes".

    In your version you say "<object type=" but I can only find "codetype" in
    the html specs and name="" and id="" simply do not exist and are replaced
    with "param=".

    This is what I'm left with: -

    <html>
    <head>
    <script type="text/javascript">
    function empchanged (txt)
    {
    var selectRef = document.forms[0]["users"];
    var optsRef = selectRef.options;
    while (optsRef.length > 0)
    {
    selectRef.remove(optsRef[0]);
    }
    var val = txt.value;
    if (val.length > 0)
    {
    document.EmpApplet.initEmployee (txt.value);

    for (;;)
    {
    var emp = document.EmpApplet.nextEmployee ();
    if (emp == null)
    break;
    selectRef.add (new Option (emp,emp) , null);
    }
    }
    }
    function setemp (sel)
    {
    document.forms[0]["employee"].value = sel.options[sel.selectedIndex].value;
    }
    </script>
    </head>
    <body>
    <form>

    <object
    width= "0" height= "0" >
    <param name="type" value="application/x-java-applet;version=1.6.0">
    <param name="archive" value="emp.jar">
    <param name="code" value="EmpApplet.class">
    <param name="codebase" value="http://1.2.3.6/">
    <param name="mayscript" value="yes">
    <param name="scriptable" value="true">
    <param name="name" value="EmpApplet">
    <param name="HOST" value="1.2.3.6">
    <param name="PORT" value="3333">
    </object>


    <input type="text" name="employee" onchange="empchanged (this);"
    onkeyup="empchanged (this);">
    <select name="users" onchange="setemp(this);"></select>
    </form>
    </body>
    </html>


    This code works with the AppletViewer and connects to my VMS name-lookup
    server (Which also proves that your mickey-mouse applet uploader is doing
    it's job) but won't work with the html as I get (depending on which html
    page I try) document.EmpApplet is null or not an object OR Object does not
    support this property or method AT
    document.EmpApplet.initEmployee(txt.value)

    I *have* copied the latest and greatest Frames example and I get "null is
    null or not an object" at test.html aka "parent.frames.appletframe.document
    is null or not an object"

    I come to you cap in hand in all humility knowing full well that I am not
    paying you for this and you have much work to do but *FOR PETE'S SAKE* if
    this is how hard it is to get a "simple" applet working then no wonder
    everyone isn't doing it :-(

    Please, please, please no frames, missionary position only code that I can
    compile and run on W2K. There is every possibility that I am an idiot and
    everyone else can do this, but on the other hand I submit to you that your
    code will simply not *compile* and run on W2K.

    Who cares? You might say; we are *nix biggots and don't care about that blah
    blah blah, but have a heart will ya? I did give the casual observer a DCL
    command file that could be just (AT)ed. I'm not asking for that but just
    change your /test/ to a remote VMS connection or tell me "You're a dickhead
    and everyone knows that your dickie$path environmental variable must be
    pointing to /test/ for frame.html to pick up test and test1"



    "Oliver Wong" <> wrote in message
    news:u9egh.5491$...
    >
    > "Richard Maher" <> wrote in message
    > news:elrds3$3b4$...
    > >
    > > I am now getting the, equally lovely, "Incompatible magic value" error

    :-(
    > > I'm guessing that it's because I'm running the latest and greatest 1.6

    JDK
    > > and the JVM on W2K won't work with that (I have run windows update; is
    > > there
    > > a seperate JVM download site?) Anyway I have a 1.4.2 JDK on a Windows98
    > > box
    > > that I'll use to build the classes and the Jar and see if that makes a
    > > difference.

    >
    > Java 1.6 (AKA Java 6, Sun gives a lot of confusing aliases to their
    > version numbering system) just got officially released a few days ago (it
    > was previously in beta). You can download the JVM from
    > http://java.sun.com/javase/downloads/index.jsp
    >
    > - Oliver
    >
    >
     
    Richard Maher, Dec 18, 2006
    #8
  9. Oliver Wong

    Oliver Wong Guest

    "Richard Maher" <> wrote in message
    news:em6942$4o0$...
    [...]
    >
    > This is what I'm left with: -
    >
    > <html>
    > <head>
    > <script type="text/javascript">
    > function empchanged (txt)
    > {
    > var selectRef = document.forms[0]["users"];
    > var optsRef = selectRef.options;
    > while (optsRef.length > 0)
    > {
    > selectRef.remove(optsRef[0]);
    > }
    > var val = txt.value;
    > if (val.length > 0)
    > {
    > document.EmpApplet.initEmployee (txt.value);
    >
    > for (;;)
    > {
    > var emp = document.EmpApplet.nextEmployee ();
    > if (emp == null)
    > break;
    > selectRef.add (new Option (emp,emp) , null);
    > }
    > }
    > }
    > function setemp (sel)
    > {
    > document.forms[0]["employee"].value =
    > sel.options[sel.selectedIndex].value;
    > }
    > </script>
    > </head>
    > <body>
    > <form>
    >
    > <object
    > width= "0" height= "0" >
    > <param name="type" value="application/x-java-applet;version=1.6.0">
    > <param name="archive" value="emp.jar">
    > <param name="code" value="EmpApplet.class">
    > <param name="codebase" value="http://1.2.3.6/">
    > <param name="mayscript" value="yes">
    > <param name="scriptable" value="true">
    > <param name="name" value="EmpApplet">
    > <param name="HOST" value="1.2.3.6">
    > <param name="PORT" value="3333">
    > </object>
    >
    >
    > <input type="text" name="employee" onchange="empchanged (this);"
    > onkeyup="empchanged (this);">
    > <select name="users" onchange="setemp(this);"></select>
    > </form>
    > </body>
    > </html>
    >
    >
    > This code works with the AppletViewer and connects to my VMS name-lookup
    > server (Which also proves that your mickey-mouse applet uploader is doing
    > it's job) but won't work with the html as I get (depending on which html
    > page I try) document.EmpApplet is null or not an object OR Object does not
    > support this property or method AT
    > document.EmpApplet.initEmployee(txt.value)


    It sounds like your problem has to do with getting JavaScript to talk to
    your Java applet, a topic on which I know almost nothing about. If nobody
    else answers here, perhaps you can crosspost the above (the FTP stuff, etc.
    does not seem relevant to me) to the JavaScript and Java newsgroup, in a new
    thread, with a subject line which summarizes the problem like "How to get
    JavaScript to talk to my Java applet" or something similar.

    - Oliver
     
    Oliver Wong, Dec 19, 2006
    #9
  10. Oliver Wong

    Oliver Wong Guest

    "Oliver Wong" <> wrote in message
    news:VTThh.86047$...
    > perhaps you can crosspost the above (the FTP stuff, etc. does not seem
    > relevant to me) to the JavaScript and Java newsgroup


    And in case you don't know how to crosspost, see
    http://www.cs.tut.fi/~jkorpela/usenet/xpost.html

    - Oliver
     
    Oliver Wong, Dec 19, 2006
    #10
  11. Hi Oliver,

    Thanks for the pointers, and you could well be right about it being a
    Javascript calling Java issue, but before I shoot off over there let me
    provide a little more info here in case it rings a bell with someone.

    My JAR file is as follows:
    Directory of C:\Java\Bojan\Applets

    17/12/2006 08:27p 3,115 emp.jar
    1 File(s) 3,115 bytes

    C:\Java\Bojan\Applets>jar -tf emp.jar
    META-INF/
    META-INF/MANIFEST.MF
    EmpApplet.class
    EmpClient.class
    EmpClient$Message.class

    Here's the Applet.html:
    <html>
    <body>
    <form>
    <applet name="EmpApplet"
    id="EmpApplet"
    code="EmpApplet.class"
    archive="emp.jar"
    codebase="http://1.2.3.6/"
    width="40"
    height="40">
    <param name="HOST" value="1.2.3.6">
    <param name="PORT" value="3333">
    </applet>
    </form>
    </body>
    </html>

    NB; I Have used a <object> tag version with exactly the same results.

    If I invoke that Applet with the 1.6 AppletViewer then it fires up and does
    what it should. If I use IE to fireup Applet.html I get:
    java.lang.ClassNotFoundException: EmpApplet.class
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    Caused by: java.net.SocketException: Unexpected end of file from server

    at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
    at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
    at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
    at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
    Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    at sun.applet.AppletClassLoader.access$100(Unknown Source)
    at sun.applet.AppletClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    .... 10 more

    So has IE misinterpreted some bytes as a premature End-of-File? (All 3115
    were sent)?
    Using ("Content-Type: application/octet-stream!/")

    Is it a compatibility issue and IE can't see a JDK-1.6-generated
    EmpApplet.class header in the JAR file?

    Should I deinstall the JDK and reinstall 1.5 (or something?)

    Can I use the -target switch on JAVAC?

    Would -debug help?

    How about JAR -e EmpApplet?

    Anything?

    Regards Richard Maher

    PS. Looks simple huh?

    "Oliver Wong" <> wrote in message
    news:NUThh.86065$...
    > "Oliver Wong" <> wrote in message
    > news:VTThh.86047$...
    > > perhaps you can crosspost the above (the FTP stuff, etc. does not seem
    > > relevant to me) to the JavaScript and Java newsgroup

    >
    > And in case you don't know how to crosspost, see
    > http://www.cs.tut.fi/~jkorpela/usenet/xpost.html
    >
    > - Oliver
    >
    >
     
    Richard Maher, Dec 21, 2006
    #11
  12. Oliver Wong

    Oliver Wong Guest

    "Richard Maher" <> wrote in message
    news:emcvmc$2po$...
    >
    > If I invoke that Applet with the 1.6 AppletViewer then it fires up and
    > does
    > what it should. If I use IE to fireup Applet.html I get:
    > java.lang.ClassNotFoundException: EmpApplet.class


    Perhaps you have the MSJVM installed instead of (or in addition to)
    Sun's JVM. See http://www.mvps.org/marksxp/WindowsXP/java.php

    Unless you have some special reason for supporting the MSJVM, you should
    probably remove it in favour of Sun's.

    - Oliver
     
    Oliver Wong, Dec 21, 2006
    #12
  13. Andrew Thompson wrote:
    > Richard Maher wrote:
    > > Hi,

    >
    > Please refrain from multi-posting, as well as using
    > 'cute' titles, in future.



    The following is crudely requoted from a strand
    to this thread on which I have no intention of
    directly replying.

    The (current) problem can be explained by the
    following four lines..

    codebase="http://1.2.3.6/"
    ....AppletViewer then it fires up and does what it should.
    If I use IE to fireup Applet.html I get:
    ....
    at java.security.AccessController.doPrivileged(Native Method)

    And, since you have not replied to it thus far, I will
    repeat.. Please refrain from multi-posting, as well
    as using 'cute' titles, in future.

    Andrew T.
     
    Andrew Thompson, Dec 21, 2006
    #13
  14. Hi Oliver,

    Thanks again for the replies.
    "Oliver Wong" <> wrote in message
    news:D2yih.72$...
    > Unless you have some special reason for supporting the MSJVM, you

    should
    > probably remove it in favour of Sun's.


    All I want to do (with no specific application in mind) is be able to show
    anyone, who asks me, how to use html, Javascript, and Java Applets to
    connect back to an application server using TCP/IP Sockets. While your
    recommendation to use the Sun JVM is probably a good one in, that it removes
    at least one more variable, I do not wish to make it a requirement.

    I'm guessing that the answer to particular my problem lies in some trivial
    environmental setting; but which one?

    The ability to Connect() back to the server where the Codebase and Archive
    files live *without having to run with specially elevated privileges* is
    functionality that I find extremely appealing! Now if I could just get it to
    work. . . :-(

    Cheers Richard Maher

    "Oliver Wong" <> wrote in message
    news:D2yih.72$...
    >
    > "Richard Maher" <> wrote in message
    > news:emcvmc$2po$...
    > >
    > > If I invoke that Applet with the 1.6 AppletViewer then it fires up and
    > > does
    > > what it should. If I use IE to fireup Applet.html I get:
    > > java.lang.ClassNotFoundException: EmpApplet.class

    >
    > Perhaps you have the MSJVM installed instead of (or in addition to)
    > Sun's JVM. See http://www.mvps.org/marksxp/WindowsXP/java.php
    >
    > Unless you have some special reason for supporting the MSJVM, you

    should
    > probably remove it in favour of Sun's.
    >
    > - Oliver
    >
    >
     
    Richard Maher, Dec 23, 2006
    #14
  15. Today's Faustian bargain (Was: Re: JAR! . . .What is it good for?. . .Absolutely nothing :)

    Hi Andrew,

    "Andrew Thompson" <> festered in message
    news:...
    > The (current) problem can be explained by the
    > following four lines..
    >
    > codebase="http://1.2.3.6/"
    > ...AppletViewer then it fires up and does what it should.
    > If I use IE to fireup Applet.html I get:
    > ...
    > at java.security.AccessController.doPrivileged(Native Method)


    I have no idea what motivates you to respond the way you do, nor do I
    particularly care, If that's how you get your jollies then good for you. But
    I'm guessing that the above was a genuine attempt at assistance, and
    possibly the answer and I'm just too thick to see it.

    If so, could you please show me what those four lines "explain" about
    getting unexpected eof on the socket to the codebase?

    The "GET" has gone to the codebase and has been (AppletViewer thinks so
    anyway) satisfied. I see no SSL request, I see no certificate or signature
    request, The JAR contains EmpApplet and all 3115 bytes have been sent. I
    looked up doPrivileged and it looked like it was asking for elevated
    privileges, is that the problem?

    Just think, if I get all these problems sorted then there's a good chance
    that I'll leave this newsgroup for good! One less irksome poster? That's
    gotta be *all* gravy.

    Regards Richard Maher

    BTW. Has anyone actually seen Andrew's CLJP Sheriff's badge? When are the
    next elections held?

    "Andrew Thompson" <> wrote in message
    news:...
    > Andrew Thompson wrote:
    > > Richard Maher wrote:
    > > > Hi,

    > >
    > > Please refrain from multi-posting, as well as using
    > > 'cute' titles, in future.

    >
    >
    > The following is crudely requoted from a strand
    > to this thread on which I have no intention of
    > directly replying.
    >
    > The (current) problem can be explained by the
    > following four lines..
    >
    > codebase="http://1.2.3.6/"
    > ...AppletViewer then it fires up and does what it should.
    > If I use IE to fireup Applet.html I get:
    > ...
    > at java.security.AccessController.doPrivileged(Native Method)
    >
    > And, since you have not replied to it thus far, I will
    > repeat.. Please refrain from multi-posting, as well
    > as using 'cute' titles, in future.
    >
    > Andrew T.
    >
     
    Richard Maher, Dec 23, 2006
    #15
  16. Hi All,

    Rather than a Java programmer problem, this ended up a "Writing a WebServer
    101" problem :-(

    Although, I had told Interenet Explorer that I only speak "http 1.0" I had
    stuck a loop on my "read" of the GET command just to check that something
    else may have come down the line. The problem appears to be that IE seems to
    want a Socket Disconnect status (at least http 1.0) to tell it that EOF has
    occured even though I told it that 3115 bytes were coming and I had already
    sent 3115 bytes.

    I took out the loop and shutdown the socket immediately after the JAR file
    was sent, and IE was happy!

    Well, sort of; did you know that IE asks me *3* times for the same Archive
    file (looks like once per class) even though all of the classes are in the
    one JAR file *and* in the manifest. Any ideas why this is so? Have I missed
    a switch on the JAR creation of on the Applet declaration? Here's the latest
    applet def: -

    <html>
    <body>
    <form>
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    width= "40" height= "40" name="EmpApplet"
    id="EmpApplet">
    <param name="archive" value="emp.jar">
    <param name="codebase"
    value=http://1.2.3.6/>
    <param name="code" value="EmpApplet">
    <param name="mayscript" value="yes">
    <param name="scriptable" value="true">
    <param name="name" value="EmpApplet">
    <param name="HOST" value="1.2.3.6">
    <param name="PORT" value="3333">
    </object>
    </form>
    </body>
    </html>

    Anyway, Merry Christmas to one and all, and I might even stretch to a real
    Java coding question next year :)

    Cheers Richard Maher

    "Richard Maher" <> wrote in message
    news:emhr95$7af$...
    > Hi Oliver,
    >
    > Thanks again for the replies.
    > "Oliver Wong" <> wrote in message
    > news:D2yih.72$...
    > > Unless you have some special reason for supporting the MSJVM, you

    > should
    > > probably remove it in favour of Sun's.

    >
    > All I want to do (with no specific application in mind) is be able to show
    > anyone, who asks me, how to use html, Javascript, and Java Applets to
    > connect back to an application server using TCP/IP Sockets. While your
    > recommendation to use the Sun JVM is probably a good one in, that it

    removes
    > at least one more variable, I do not wish to make it a requirement.
    >
    > I'm guessing that the answer to particular my problem lies in some trivial
    > environmental setting; but which one?
    >
    > The ability to Connect() back to the server where the Codebase and Archive
    > files live *without having to run with specially elevated privileges* is
    > functionality that I find extremely appealing! Now if I could just get it

    to
    > work. . . :-(
    >
    > Cheers Richard Maher
    >
    > "Oliver Wong" <> wrote in message
    > news:D2yih.72$...
    > >
    > > "Richard Maher" <> wrote in message
    > > news:emcvmc$2po$...
    > > >
    > > > If I invoke that Applet with the 1.6 AppletViewer then it fires up and
    > > > does
    > > > what it should. If I use IE to fireup Applet.html I get:
    > > > java.lang.ClassNotFoundException: EmpApplet.class

    > >
    > > Perhaps you have the MSJVM installed instead of (or in addition to)
    > > Sun's JVM. See http://www.mvps.org/marksxp/WindowsXP/java.php
    > >
    > > Unless you have some special reason for supporting the MSJVM, you

    > should
    > > probably remove it in favour of Sun's.
    > >
    > > - Oliver
    > >
    > >

    >
    >
     
    Richard Maher, Dec 23, 2006
    #16
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    613
    Arnold Peters
    Jan 5, 2005
  2. muttley
    Replies:
    0
    Views:
    2,767
    muttley
    Oct 20, 2005
  3. cyberco
    Replies:
    4
    Views:
    3,847
    Roedy Green
    Feb 14, 2006
  4. Arnold Peters
    Replies:
    0
    Views:
    689
    Arnold Peters
    Jan 5, 2005
  5. Devin Jeanpierre
    Replies:
    2
    Views:
    512
    Devin Jeanpierre
    Feb 14, 2012
Loading...

Share This Page