Applet in JAR Question

Hello,
When you publish an applet that is stored inside a JAR file, does the entire JAR file get downloaded by client browsers upon loading the page? Or do the individual class files get downloaded only when needed by the client JVM?
Thanks,
Andrew

The entire jar.

Similar Messages

  • Simple applet jar question

    I'm sure this is an easy question, but how do you access subdirectories in your applet's jar file?
    For instance the contents of MyApplet.jar jar would be:
    * META-INF
    * images
    * net
    Say the main class is MyApplet.class in net/mydomain/myproject
    How in the main class would I get at images/MyImage.jpg?
    Obviously I did not get this code to work:
    ImageIcon upIcon = new ImageIcon("images/MyImage.jpg");
    Thanks alot!

    Actually now I am using:
    ImageIcon upIcon = new ImageIcon(MyApplet.class.getResource("/images/MyImage.jpg"));
    This way the 'absolute' resource is found (becuase the resource name starts with a '/').
    This seems to be the best way to do it.

  • Applet in Netscape question.

    Hi, Applet in Netscape question.
    When an applet is run by Explorer everything is OK when trying to run with Netscape (7.1) nothing happening
    What is wrong here ???
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = "730" HEIGHT = "260"
    codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-
    windows-i586.cab#Version=1,3,0,0">
    <PARAM NAME = CODE VALUE = "Xaaa.class" MAYSCRIPT>
    <PARAM NAME = ARCHIVE VALUE = "Ybbb.jar">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">
    <PARAM NAME="scriptable" VALUE="false">
    <PARAM name="progressbar" value="true">
    </OBJECT>
    Thank you in advance !

    Dear Experts.
    Reading through previous Forum similar questions, I changed the code (down below)
    Now I receive the message:
    Click here to get the plugin
    This is encouraging because before Netscape ignored the applet completely ...
    However I already have plugin version 1.4.2_03 installed (and recognized by Explorer)
    The question is still why the applet is not working with Netscape ?
    Thank you in advance for your help?
    <html>
    <body>
    <!-- HTML CONVERTER -->
    <object
    classid =" clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    codebase =" http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0"
    width = 730 height = 260 >
    <param name = CODE value ="Xaaa.class" >
    <param name = ARCHIVE value ="Ybbb.jar" >
    <param name =" type" value =" application/x-java-applet;jpi-version=1.4">
    <param name =" scriptable" value =" false">
    <param name="progressbar" value="true">
    <comment> </comment>
    <embed
    type =" application/x-java-applet;version=1.4"
    code =" Xaaa.class"
    archive ="Ybbb.jar"
    width = 730
    height =260
    scriptable = false
    pluginspage =" http://java.sun.com/products/plugin/index.html#download">
    <noembed> alt="Your browser understands the <APPLET>
    tag but isn't running the applet, for some reason."
    Your browser is completely ignoring the <APPLET>
    tag! </noembed> </embed> </object>
    <!--"END_CONVERTED_APPLET"-->
    </html>
    </body>

  • How do I update a file in an Applet's JAR file from the Applet code

    Here's my problem.
    My applet is using a serializable history data in which I am storing in the applet's JAR file. When I run the applet, I read the file with "getResourceAsStream()" and run my program with that hist data. When my applet is closed, I need to update this file from my Applet's code and I dumfounded about how to do that.
    Is there any way to update a file in the Applet's JAR file through the Java Applet code? (i.e. OutputStream?).
    Would appreciate any advice people have.

    Just place a copy of the file on the local hard disk and update that. When you start the Applet you try to read from the hard disk. If the file exists then no problem otherwise copy it from the jar to the hard disk.

  • Problem loading Applets from Jar files on 64 bit machine

    I am developing an applet (extends Applet but uses swing components) using JDK 1.6 (Though these problems still happen in JDK 1.7) and I am unable to get the applet to load on a 64 bit machine in most cases. The web server(s) are running on localhost and I am connecting on the same machine using a local network ip address (such as 192.168.*.*)
    Below are all of my test results. Can someone provide a suggestion for repairing this? The Windows Server machine is a clients computer I access to it via remote desktop but I can't do much with it though I do have administrator rights. The Windows 7 machine is my development platform so I have been able to do extensive testing on it.
    This problem is presenting in the following environments when trying to load an applet from JAR files in a HTML document using the Applet or Object tag.
    Windows Server 2008 (Intel Chipset)
    Tested Browsers:
    Internet Explorer 9 (32 bit) - Shows it is blocked by default then simply shows an x when loaded from a web page, same result when loading from local drive.
    Windows 7 Home Premium (AMD Chipset)
    Tested Browsers:
    Firefox 6.0.1 (32 bit) - Java logo shows with spinner, after a few minutes there is finally an error that a class in the jar was not found
    Internet Explorer 9 (32 bit) - Java logo shows with spinner, after a few minutes there is finally an error that a class in the jar was not found
    Internet Explorer 9 (64 bit) - Java logo shows with spinner and most of the windows desktop manager freezes, keyboard is the only thing that responds so you can alt-tab to another app to regain control of the desktop.
    Chrome (32 bit) - Java logo shows with spinner, after a few minutes there is finally an error that a class in the jar was not found
    The only way I have been able to get a Java applet to run on a 64 bit machine are the following ways.
    Firefox 9 nightly (64 bit) works perfectly! Go Firefox!
    Internet Explorer 9 (32 bit) loading directly from drive (c:\...)
    Chrome (32 bit) loading directly from drive (c:\...)
    Firefox 6.0.1 (32 bit) loading directly from drive (c:\....)
    Can someone please help! I've been fighting with this bug for over a week and I can't find anything that will solve it, I have noticed that in some cases if my jar has very little code in it than it will run on the server, but the minute I start adding things to it the jar won't load anymore.

    jschell wrote:
    rritoch wrote:
    I am developing an applet (extends Applet but uses swing components) using JDK 1.6 (Though these problems still happen in JDK 1.7) and I am unable to get the applet to load on a 64 bit machine in most cases.
    To clarify...
    1. You have tried it on 32 bit machine? Exactly which OS?I tested this on Windows Vista Business which is in 32 bit mode and the applets run without any problems
    >
    2. Your only 64 bit tests have involved 2008/Win7?
    If so then I would suspect something with windows not java. Probably permissions.
    The web server(s) are running on localhost and I am connecting on the same machine using a local network ip address (such as 192.168.*.*)
    Yes, I haven't tried running the jars on other operating systems.
    >
    I don't understand that. If you are running on localhost then you should connect to localhost. If running on an IP then you should connect to that. Perhaps you meant that you have tested using both of those?I'm testing using the lan ip address but I'm connecting from the same machine. I've tried localhost and that didn't work so I tried lan ip since that will likely have a different java security context than localhost. At first I was blaming the IIS server but I downloaded the jar directly and using HTTP fox was able to verify that the jar is being sent with the correct mime-type and that the server can upload the jar file without a problem. This leaves me to believe the problem is with Java.

  • Yup, a Jar question

    i have really really tried to answer this question.
    i searched the forums. i read the api.
    so please, haha, please help.
    i know jar questions dont typically get a warm reception.
    I have a folder containing a couple folders and one jar file.
    Images/
    Data/
    MyApp.jar
    i cannot access the images in the Images folder.
    im getting this error:
    Resource not found: /Images/ToolBar/pic.gif
    Uncaught error fetching image:
    java.lang.NullPointerException
    at sun.awt.image.URLImageSource.getConnection(URLImageSou
    9)
    at sun.awt.image.URLImageSource.getDecoder(URLImageSource
    at sun.awt.image.InputStreamImageSource.doFetch(InputStre
    rce.java:248)
    at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java
    at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
    this is the code i use to load images:
    String imgLocation = "Images/ToolBar/" + imageName + ".gif";
    URL imageURL = MyClass.class.getResource(imgLocation);i also tried it with a "/" before "Images" in the code.
    I tried adding the folder to the manifests classpath.
    I also tried knocking on wood and counting sheep.

    the way my computer is configured i never use "-cp . " when
    running a java program.
    it usually uses the present directory as the class path.
    but i have looked into that (maybe im doing it wrong).
    im running "java -jar MyApp.jar" from the command-line (in XP)
    from the directory that holds the .jar and the Images/ folder.
    i tried "java -cp . -jar..."
    i also tried putting the class path in the manifest file but every\ytime
    i did that i got "no class in main" error.
    if C:\My\Program contains MyApp.jar and directory Images/
    Class-Path: C:\My\Program\Images
    didnt work
    Class-Path: C:\My\Program ; C:\My\Program\Images
    didnt work
    i tried the / both directions
    ive tried countless permutations of this.getclassloader / getclass blah blah also.
    every thread gives the class loader as the answer but so far
    nothing has worked.
    its amazing how many times this question has been asked and
    there usually isnt an answer.
    im depressed, haha.

  • JRE 1.7 / Java Plug-in - Long delay in retrieving the applet File(JAR) due to a request to the Domain Controller(on port 53)

    Description:
    A specific group of users/customers (using Windows7 OS with IE and FireFox web browsers) are facing problems with retrieving the applet File, after they upgraded the JRE on the system(PC) to JRE 1.7.0_25-b17 from JRE version 1.6.0_29-b11.
    With JRE 1.7.0_25-b17 it is noticed that when the Java plugin requests for the applet File; it sends a request to the Domain Controller of the user, which causes a delay of 2 to 5 minutes and sometimes hangs. The problem occurs consistently.
    The current temporary workaround for this group of users is to use JRE version 1.6.0_29-b11.
    Problem analysis:
    To investigate the problem the below steps were executed:
    1) Collected the Java console outputbelow details from the user's system. (The complete output is not posted due to lengthy content, though can be added further to this post if required.)
    (a) Works fine with JRE version 1.6.0_29-b11. Kindly refer to Java console output in the code ‘section A’ towards the end of this post.
    (b) The problem occurs with problem with JRE version 1.7.0_25-b17. Kindly refer to Java console output in the code ‘section B’ towards the end of this post. The step where the problem is observed, is indicated as(##<comment>##).
    2) The network settings in the user's browser was checked. Internet Options > Connections > LAN setting
    The configured option is 'Use automatic configuration script' and the value is http://www.userAppX.com/proxy.pac
    This configuration remains the same irrespective of the JRE version in use.
    3) The network settings in the Java Control Panel was checked.
    The used/selected option is "Use browser settings", although values for 'Use proxy server' and 'use automatic proxy configuration script' are filled-in as 'user-proxy.com' and 'http://www.userAppX.com/proxy.pac' respectively.
    This configuration remains the same irrespective of the JRE version in use.
    4) The proxy PAC file was checked and debugging was done for the request 'https://myAppletHost.com/download/...'. The FindProxyForUrl function (including the conditions defined in it, for the hostname and domain checks) returns PROXY user-proxy.com:80
    5) The user also tried the below
    a. Changed the option in the network settings in the browser to 'Proxy server' with Address 'user-proxy.com' and Port '80'
    b. Restarted the browser.
    c. Tried with Java Plug-in 1.6.0_29, JRE version 1.6.0_29-b11. There was no problem and no request to the Domain Controller of the user.
    d. Tried with Java Plug-in 10.40.2.43, JRE version 1.7.0_40-b43. The problem occurs with the delay and a request to the Domain Controller of the user is observed.
    Kindly refer to Java console output in the code ‘section C’ towards the end of this post.
    6) The user also tried setting the below property in the Java Control panel; restarted the browser, and try with JRE 1.7.0_40-b43. The problem stil persists.
    -Djava.net.preferIPv4Stack=true
    7) The Global Policy Management of the Domain Controller was verified by the user. It has GPO for proxy setting but nothing related to Java security.
    Questions:
    The problem seems be specific to a particular (user) environment setup, and the user faces the problem when using JRE 1.7.
    We would like to know if the issue is in the (user) environment setup or in JRE 1.7.
    Could you please help with information/ideas/suggestions to identify the root cause and solution for this problem?
    Section A:
    Java Plug-in 1.6.0_29
    Using JRE version 1.6.0_29-b11 Java HotSpot(TM) Client VM
    User home directory = C:\Users\userA
    basic: Plugin2ClassLoader.addURL parent called for https://myAppletHost.com/download/myApplet.jar
    network: Connecting https://myAppletHost.com/download/myApplet.jar with proxy=HTTP @ user-proxy.com/194.xxx.xx.xx:80
    network: Server https://myAppletHost.com/download/myApplet.jar requesting to set-cookie with "BCSI-CS-b1bb5056c5b0e83f=2; Path=/"
    network: Server https://myAppletHost.com/download/myApplet.jar requesting to set-cookie with "BCSI-CS-b1bb5056c5b0e83f=2; Path=/"
    security: Loading Root CA certificates from C:\Program Files (x86)\Java\jre6\lib\security\cacerts
    security: Loaded Root CA certificates from C:\Program Files (x86)\Java\jre6\lib\security\cacerts
    security: Loading SSL Root CA certificates from C:\Program Files (x86)\Java\jre6\lib\security\cacerts
    security: Loaded SSL Root CA certificates from C:\Program Files (x86)\Java\jre6\lib\security\cacerts
    security: Loading certificates from Deployment session certificate store
    security: Loaded certificates from Deployment session certificate store
    security: Loading certificates from Internet Explorer ROOT certificate store
    security: Loaded certificates from Internet Explorer ROOT certificate store
    security: Checking if certificate is in Deployment denied certificate store
    network: Connecting https://myAppletHost.com/download/myApplet.jar with cookie "JSESSIONID=0000IK4bEMoqXH10zsl88rwvoRI:175oe9tjd; BCSI-CS-b1bb5056c5b0e83f=2"
    network: Downloading resource: https://myAppletHost.com/download/myApplet.jar
                    Content-Length: 403.293
                    Content-Encoding: null
    Dump system properties ...
    https.protocols = TLSv1,SSLv3
    java.vm.info = mixed mode, sharing
    java.vm.name = Java HotSpot(TM) Client VM
    java.vm.specification.name = Java Virtual Machine Specification
    java.vm.specification.vendor = Sun Microsystems Inc.
    java.vm.specification.version = 1.0
    java.vm.vendor = Sun Microsystems Inc.
    java.vm.version = 20.4-b02
    javaplugin.nodotversion = 160_29
    javaplugin.version = 1.6.0_29
    javaplugin.vm.options =
    os.arch = x86
    os.name = Windows 7
    os.version = 6.1
    trustProxy = true
    deployment.proxy.auto.config.url = http://www.userAppX.com/proxy.pac
    deployment.proxy.bypass.local = false
    deployment.proxy.http.host = user-proxy.com
    deployment.proxy.http.port = 80
    deployment.proxy.override.hosts =
    deployment.proxy.same = false
    deployment.proxy.type = 3
    deployment.security.SSLv2Hello = false
    deployment.security.SSLv3 = true
    deployment.security.TLSv1 = true
    deployment.security.mixcode = ENABLE
    Section B:
    Java Plug-in 10.25.2.17
    Using JRE version 1.7.0_25-b17 Java HotSpot(TM) Client VM
    User home directory = C:\Users\userA
    basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@12adac5
    basic: Plugin2ClassLoader.addURL parent called for https://myAppletHost.com/download/myApplet.jar
    network: Connecting https://myAppletHost.com/download/myApplet.jar with proxy=HTTP @ user-proxy.com/194.xxx.xx.xx:80
    network: Server https://myAppletHost.com/download/myApplet.jar requesting to set-cookie with "BCSI-CS-2d4ce94a2ae7b460=2; Path=/"
    network: Connecting http://10.x.x.xx:53/ with proxy=DIRECT
                    (##THE ABOVE REQUEST CAUSES THE DELAY OR HANGS##)
    network: Server https://myAppletHost.com/download/myApplet.jar requesting to set-cookie with "BCSI-CS-2d4ce94a2ae7b460=2; Path=/"
    security: Loading Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
    security: Loaded Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
    security: Loading SSL Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
    security: Loaded SSL Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
    security: Loading certificates from Deployment session certificate store
    security: Loaded certificates from Deployment session certificate store
    security: Loading certificates from Internet Explorer ROOT certificate store
    security: Loaded certificates from Internet Explorer ROOT certificate store
    network: Connecting https://myAppletHost.com/download/myApplet.jar with proxy=HTTP @ user-proxy.com/194.xxx.xx.xx:80
    network: Server https://myAppletHost.com/download/myApplet.jar requesting to set-cookie with "BCSI-CS-2d4ce94a2ae7b460=2; Path=/"
    network: Server https://myAppletHost.com/download/myApplet.jar requesting to set-cookie with "BCSI-CS-2d4ce94a2ae7b460=2; Path=/"
    network: Connecting https://myAppletHost.com/download/myApplet.jar with cookie "JSESSIONID=0000UQuXWY5tjxjpwcKHlfJKe_8:175oe9j45; BCSI-CS-2d4ce94a2ae7b460=2"
    network: ResponseCode for https://myAppletHost.com/download/myApplet.jar : 200
    network: Encoding for https://myAppletHost.com/download/myApplet.jar : null
    network: Server response: (length: -1, lastModified: Thu Feb xx yy:yy:yy CET 2013, downloadVersion: null, mimeType: text/plain)
    network: Downloading resource: https://myAppletHost.com/download/myApplet.jar
                    Content-Length: -1
                    Content-Encoding: null
    Section C:
    Java Plug-in 10.40.2.43
    Using JRE version 1.7.0_40-b43 Java HotSpot(TM) Client VM
    User home directory = C:\Users\userA
    basic: Plugin2ClassLoader.addURL parent called for https://myAppletHost.com/download/myApplet.jar
    network: Connecting https://myAppletHost.com/download/myApplet.jar with proxy=HTTP @ user-proxy.com/194.xxx.xx.xx:80
    network: Server https://myAppletHost.com/download/myApplet.jar requesting to set-cookie with "BCSI-CS-1d67c8b6508ca09c=2; Path=/"
    network: Connecting http://10.x.x.xx:53/ with proxy=DIRECT
                    (##THE ABOVE REQUEST CAUSES THE DELAY OR HANGS##)
    network: Checking for update at: https://javadl-esd-secure.oracle.com/update/blacklist
    network: Checking for update at: https://javadl-esd-secure.oracle.com/update/blacklisted.certs
    network: Checking for update at: https://javadl-esd-secure.oracle.com/update/baseline.version
    network: Connecting https://javadl-esd-secure.oracle.com/update/blacklist with proxy=HTTP @ user-proxy.com/194.xxx.xx.xx:80
    network: Connecting https://javadl-esd-secure.oracle.com/update/baseline.version with proxy=HTTP @ user-proxy.com/194.xxx.xx.xx:80
    network: Connecting https://javadl-esd-secure.oracle.com/update/blacklisted.certs with proxy=HTTP @ user-proxy.com/194.xxx.xx.xx:80
    security: Loading Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
    security: Loaded Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
    security: Loading SSL Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
    security: Loaded SSL Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
    Dump system properties ...
    https.protocols = TLSv1,SSLv3
    java.vm.info = mixed mode, sharing
    java.vm.name = Java HotSpot(TM) Client VM
    java.vm.specification.name = Java Virtual Machine Specification
    java.vm.specification.vendor = Oracle Corporation
    java.vm.specification.version = 1.7
    java.vm.vendor = Oracle Corporation
    java.vm.version = 24.0-b56
    javaplugin.nodotversion = 10402
    javaplugin.version = 10.40.2.43
    os.arch = x86
    os.name = Windows 7
    os.version = 6.1
    trustProxy = true
    active.deployment.proxy.auto.config.url = http://www.userAppX.com/proxy.pac
    active.deployment.proxy.bypass.local = false
    active.deployment.proxy.http.host = user-proxy.com
    active.deployment.proxy.http.port = 80
    active.deployment.proxy.same = false
    active.deployment.proxy.type = 3
    deployment.browser.path = C:\Program Files (x86)\Internet Explorer\iexplore.exe
    deployment.proxy.auto.config.url = http://www.userAppX.com/proxy.pac
    deployment.proxy.bypass.local = false
    deployment.proxy.http.host = user-proxy.com
    deployment.proxy.http.port = 80
    deployment.proxy.override.hosts =
    deployment.proxy.same = false
    deployment.proxy.type = 3                                                                                                                                                                                                                                                            
    deployment.security.SSLv2Hello = false
    deployment.security.SSLv3 = true
    deployment.security.TLSv1 = true
    deployment.security.TLSv1.1 = false
    deployment.security.TLSv1.2 = false
    deployment.security.authenticator = true
    deployment.security.disable = false
    deployment.security.level = HIGH
    deployment.security.mixcode = ENABLE
    PS:
    Since the JRE 1.7.0_25-b17 update, it is noticed that when the Java plugin requests for the applet File; it sends a request to the Domain Controller of the user, which causes a delay of 2 to 5 minutes and sometimes hangs.
    The problem occurs consistently, and also with JRE 1.7.0_45-b18.
    Java Plug-in 10.45.2.18
    Using JRE version 1.7.0_45-b18 Java HotSpot(TM) Client VM
    User home directory = C:\Users\userA
    c:   clear console window
    f:   finalize objects on finalization queue
    g:   garbage collect
    h:   display this help message
    l:   dump classloader list
    m:   print memory usage
    o:   trigger logging
    q:   hide console
    r:   reload policy configuration
    s:   dump system and deployment properties
    t:   dump thread list
    v:   dump thread stack
    x:   clear classloader cache
    0-5: set trace level to <n>
    cache: Initialize resource manager: com.sun.deploy.cache.ResourceProviderImpl@134a33d
    basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@1971f66
    basic: Plugin2ClassLoader.addURL parent called for https://myAppletHost.com/download/myApplet.jar
    network: Connecting https://myAppletHost.com/download/myApplet.jar with proxy=HTTP @ user-proxy.com/194.xxx.xx.xx:80
    network: Server https://myAppletHost.com/download/myApplet.jar requesting to set-cookie with "BCSI-CS-f797d4d262467220=2; Path=/"
    network: Connecting http://10.x.x.xx:53/ with proxy=DIRECT
    network: Connecting http://10.x.x.xx:53/ with proxy=DIRECT
                    (##THE ABOVE REQUEST CAUSES THE DELAY AND SOMETIMES HANGS##)

    My organization is experiencing very similar problems.  We have resolved it through several steps.
    We upgraded the client to Java 8 and we saw in the console that the hanging connection with the Domain Controller no longer occurs.  This may be all that is necessary for your environment as well. 

  • Can javascript pass values to applet inside jar file?

    I have an applet that receives the computer name selected via javascript and then resolves the name with the name server and returns any available ip addresses (via a browser). When running this applet unsigned, I can only resolve my own local machine and I get security exception errors(access denied) for any other computer selections (this would be expected).
    I have created a jar file encompassing the class file and java file for this applet signing it with the designated signature. When using the jar file, the applet will start, but no names can be resolved (including the local machine) and there are no errors on the java console...(???)
    HTML code is as follows:
    <html>
    <body>
    <form>
    <fieldset style="width:100%"><legend>  ?</legend>
    <select name="CNList"
    onChange="var f = document.forms[0]
    if (f.CNList.options[f.CNList.selectedIndex].text=="") {
    alert("Please choose a computer name for this test.");
    f.CNList.focus();
    return false;
    }else{
    var cnv = f.CNList.options[f.CNList.selectedIndex].text;
    document.myApplet.newText(cnv);
    return false;"
    >
    <option value="-SELECT COMPUTER NAME-" selected>-SELECT COMPUTER NAME-
    <option value="BELKNAP">BELKNAP
    <option value="DOWNS">DOWNS
    <option value="GSIMS">GSIMS
    <option value="SPOTSYLVANIA">SPOTSYLVANIA
    <option value="CEDAR">CEDAR
    <option value="BELLMEAD">BELLMEAD
    <option value="ASHLAND">ASHLAND
    <option value="COMFORT">COMFORT
    <option value="ROSS">ROSS
    <option value="PUTNAM">PUTNAM
    <option value="CHARITY">CHARITY
    <option value="FRODO">FRODO
    <option value="PLUTO">PLUTO
    <option value="DENTON">DENTON
    <option value="HOOD">HOOD
    <option value="KODIAK">KODIAK
    <option value="SUNDOWN">SUNDOWN
    <option value="FROST">FROST
    <option value="TRINITY">TRINITY
    <option value="LOUDOUN">LOUDOUN
    <option value="MPAPE">MPAPE
    <option value="QUENTIN">QUENTIN
    <option value="DUNDEE">DUNDEE
    <option value="SIGMA">SIGMA
    <option value="PSI">PSI
    <option value="CUBE">CUBE
    <option value="ALOHA">ALOHA
    <option value="OBION">OBION
    </select>
    <br />
    <applet code=NSQuery2.class
            archive="NSQuery2.jar"
            width=400 height=250
         name="myApplet"
         id="myApplet"
         >
         <p>Sorry, you need a Java enabled browser to see the applet's info.</p>
    </applet>
    </form>
    </body>
    </html>JAVA Applet code is as follows:
    /* Gets ComputerName selected, returns IP Address(es)*/
    // Instead of importing just 1 or 2 parts of java.awt and java.applet classes,
    // we have chosen to import everything at once.
    // To do this we use the wildcard operator (*).
    import java.awt.*;
    import java.applet.*;
    import java.io.*;
    import java.lang.String;
    import java.net.InetAddress;
    public class NSQuery2 extends Applet {
    // This declares a string variable named computerName for future use.
    String computerName;
      public void init() {
      // Set background color of our applet to white.
      setBackground(Color.white);
      public void paint(Graphics g) {
        super.paint(g);
        try {
          g.drawString("Computer Name: " + this.computerName, 23, 43);
          String[] ips = new queryhost().getIPAddressArray(this.computerName);
            for (int j=0; j<ips.length; j++) {
          g.drawString("IP Address   : " + ips[j], 23, (12*j)+((j+10)+91));
        } catch (Exception e) {
                g.drawString("Can't detect selected host name.  Check Network settings.", 23, 60);
       public static void main(String[] args) { new NSQuery2(); }
       public static String[] getIPAddressArray(String computerName) {
       //create int which is (sRemoteHost.length() + 1)
       int sRemoteHostchars = computerName.length();
         sRemoteHostchars++;
        //below returns a array of type InetAddress which holds entries such as: hostname1/IPAddress1 etc
       InetAddress[] remoteHostName = null;
       try {
          remoteHostName = InetAddress.getAllByName(computerName); // get IP Address(es)
       catch (Exception e) {
          e.printStackTrace();
        // below creates an array of type string which holds entries such as : IPAddress1 etc
        String[] remoteIP = new String[ remoteHostName.length ] ;
        for (int i=0; i<remoteHostName.length; i++) {
           String iponly = remoteHostName.toString();
    iponly = iponly.substring(sRemoteHostchars);
    remoteIP[i] = iponly;
    return remoteIP;
    public void newText(String s){
    this.computerName = s;
    repaint();
    Anyone have any ideas as to why this can't be performed?
    Thanks in advance,
    Geoff-

    Hey thanks for the response (seems that most responses
    are gender specific around here :) )!No, they are not. Ask a good question (not "do my homework for me") and ask it specifically, and you will get good help whatever your gender. I am a girl; I make no attempt to hide this. I have always gotten good, solid advice from this forum without any reference to my gender, without any ascerbic remarks, without scorn from the respondant.
    You are probably referring to the "girl needs som help" thread or other recent threads from girls (well maybe girls, who knows).
    The content of these posts were:
    1) asking to help with blatant cheating on homework
    2) extremely vague
    3) used the OPs gender as an excuse for 1) and/or 2)
    Using your gender as an excuse for being unable to put code together and requesting help with cheating:
    -implies girls are too stupid to do math, programming, engineering
    -implies that girls who are in these fields are freaks/mutants/other
    -implies that gender is an exucse for laziness
    -implies that girls cannot think logically
    -implies that girls do not have to follow rules of integrity, or that girls have no integrity
    Such posts understandibly raise the ire of women software engineers who have worked hard to get where they are. (And also of male software engineers who can see through the request as a play on a stereotype)
    It is akin to a girl coming to my office hours and saying "I have my mechanics final exam tomorrow, but I didn't study all semester because I'm a girl and math is too haaaaard"
    Honestly, I would try to help the girl as much as I could, not because she's a girl, but because it is part of my duty, my responsibility, to help students.
    But before I could do it, I would have to count to ten a few times to get my temper under control.
    jen

  • Loading multiple-package applet from JAR

    Hi, apologies in advance if this has been dealt with in this forum already. I've got two questions:
    Question one: I have written two packages, evolve and fences. I would like to run fences.Fences.class which is an applet. I went to my classpath directory and typed
    jar cf mystuff.jar evolve fences
    (each package lives in its own directory off the classpath.)
    then made a web page that said
    <html><body>
    <applet code=fences.Fences.class archive=mystuff.jar>
    </applet>
    </body></html>
    I then piped the HTML file and mystuff.jar up to a remote server to make sure I wasn't reading my local fences package, made them world readable, and tried to load the web page. On my local machine, a Linux box running Galeon 1.2.5 (Mozilla, basically), I could load the applet. On a separate box running IE 5 I got the error in the status bar "load: class fences.Fences not found" . I'm not sure how to open the Java console in IE so I can't give any more info than that.
    I suspect that perhaps my local box is still somehow using my local classes or an old copy of the applet and is not loading from the archive, but I can't be sure.
    Question two: Until stumbling upon the answer in this forum, I wasn't sure how to run an applet that used more than one user-created package. I see that I can package both into one archive; but I thought that I could also have separate .jar files for each package and then specify both in the "archive=" <applet> parameter. It didn't seem to work. Anybody know if there's a way to do this?
    Thanks in advance for any help!

    yes, i've seen that since i originally posted, tried it - didn't work. I've since tried another even simpler test, to try to isolate the problem. I wrote this code in a file called Tester.java:
    import javax.swing.*;
    class Tester extends JApplet {
      public void init() {
        getContentPane().add(new JButton("Hi"));
    }I compiled this class and put it at http://www.cs.uga.edu/~gundlach/jartry/Tester.class . I then created a webpage in the jartry/ directly that says:
    <html><body>
    <applet code=Tester.class width=55 height=68></applet>
    </body></html>
    Then, using Mozilla to go to http://www.cs.uga.edu/~gundlach/jartry/test.html , I get the applet with the single button. When I open it in IE 5, it says "load class Tester not found" when I mouseover the applet.
    What the heck am I doing wrong?
    Thanks
    Michael

  • Unable to load database driver from my applet's jar file

    I'm trying to set up an applet that will talk to a MySQL database. I have no problem connecting to the database as I'm developing the code ("un-jarred"), but when I create a jar file of my code to test through a web browser, I cannot connect to the database due to the usual ClassNotFoundException. I have included mysql-connector-java-3.1.12-bin.jar (the current driver) in the jar, but I don't know if I'm supposed to supply some info through an attribute to the applet tag to let it know that the jar contains the driver it needs or if I have to call the driver differently in my code.
    Any help is appreciated, thanks.

    The simplest approach is always the best. :)Abso-lutely.
    Awesome, that worked perfectly. I Included the extra
    jar file in the applet tag and now my applet makes
    some sweet lovin' to the database.And you have succeeded where thousands have failed. Congratulations.

  • Get list of classes present in an applet's Jar file?

    I have an applet for drawing diagrams, which is bundled in a jarfile together with classes for each type of element in the drawing (e.g. a class for drawing 2-input NAND gates, a class for J-K flip-flops, and so on). When I add a new type of drawing element I have to modify the applet to add the new class to the applet's "Insert" menu to allow the element to be inserted. What I want to do is to search the jarfile containing the applet for any classes derived from DrawingElement and add them automatically to the Insert menu when the applet is inited. I presume this would require using getClass().getClassLoader() to get the class loader that read the JAR file, but from there it would seem I need to know the name of the resource to load. Is there a way of browsing the list of resources in the JAR file?

    AndrewThompson64 wrote:
    That 'modify the applet' is not strictly necessary. The list of menu items and classes might be passed to the applet as applet parameters, or as a property file or XML (or whatever) that defines the available elements.I could do this -- I'm just trying to avoid getting the list out of step with the contents (or if you prefer, I'm just being lazy!).
    Is there a way of browsing the list of resources in the JAR file?Yes and no. You might try this general strategy (untested).
    1) Gain an URL to a resource in the Jar in which the plug-ins exist.
    2) Parse that URL for everything before the '!' symbol to get an URL for the Jar itself.
    3) Get an InputStream from the Jar via URL.openStream().
    4) Get a ZipInputStream by wrapping the InputStream.
    5) Iterate the ZipEntry(s) to identify classes in the correct package, and store them in a collection of some type.
    6) Iterate the collection and check each one for extending DrawingElement, using reflection.
    I am guessing step 6 will require the applet to be trusted.Sounds plausible, and I'll give it a whirl. However, I hadn't thought about the "trusted" bit of this; maybe I can just create new instances and cast to DrawingElement, ignoring any that throw exceptions. I'll have to give it a go and see what happens.
    BTW - once you have the right classes, how do you get the screen name of them? Is the name defined in one of the attributes of a DrawingElement? What prevents name clashes?Plan A: I have a getIdentification() method that returns a string identifying the element, but I have to keep this unique the hard way (by hand).
    Plan B: use the class name with some prettification (e.g. have a class _2_input_NAND_gate which gets displayed as "2 input NAND gate") so that the compiler does the work of keeping it unique. Not sure I like this, though.
    Many thanks for your help.

  • Reading from the Applet's JAR file.

    Is it possible to read a file stored in the jar file that the (unsigned) applet is being executed in? I have a line that goes like (in is just an InputStream):
    in = getClass().getResource( "/exercise.xml" ).openStream();
    and then, in another class, i do (bulider is an instance of javax.xml.parsers.DocumentBuilder, created from the DocumentBuilderFactory class):
    doc = builder.parse( in );
    but this always results in a security exception (works fine from the applet viewer). I tried specifying the full path to the .jar file as the codebase, but got the same results. I have not tested this from an actual web server, i am only opening the .html file directly in IE.
    Due to the nature of the application, it is not possible to host the file seperately on a webserver.
    It seems to me that there is no reason an applet shouldnt be allowed to load a file from the .jar it is executing in, could this simply be a problem of the file being local, and thus linked to from a file:// tag?
    Thanks for any help.
    Thomas Stephens

    Hi Guys
    I have figured out this problem. It's got to do with classloader.
    Applet uses a separate classloader. So using the static getSystemResource(),
    we never get contents from applet jar files. The following will work nicely.
    It is noted that you must loacate the applet classloader as in the first line
    and use the non-static method getResource();
    ObjectInJar obj = new ObjectInJar(); // create an object with a class in the jar file.
    ClassLoader cl = obj.getClass().getClassLoader();
    InputStream stream = cl.getResource("your_filepath_in_jar").openStream();
    Cheers.

  • Java 7: Problems launching applets with jars on "file://" location

    Hi,
    We are experiencing a problem when updating our client's JRE from Java6 U 21 up to Java7 U 55.
    We have developed an Applet which is composed by several JAR files. Some of those JARs must be stored in local drive, and the JAR with the main Java class is stored on server.
    Let's supose we have a similar scenario like this:
    https://blahblahbah/bar.jar
    https://blahblahbah/test.html
    C:/foo.jar
    The code of test.html:
    <embed
      archive="file:///C:/foo.jar"
      cache_archive="bar.jar"
    />
    This code works fine on Java 6 and Applet is correctly loaded.
    However, with Java 7 a security exception is raised when trying to load JAR files from "file:///" location during Applet launch:
    java.lang.SecurityException: Permission denied: file:/C:/foo.jar
        at sun.plugin2.applet.Applet2Manager._loadJarFiles(Unknown Source)
    We have tried several tests using a java.policy file which grants all possible permisions:
    grant codeBase "file:/C:/foo.jar" {
        permission java.security.AllPermission;
    grant {
      permission java.security.AllPermission;
    We also tried to low Java's security level to "MEDIUM", with no success.
    We finally only managed to run the Applet if we explicity disable the "Next-Generation Plugin" with Internet Explorer 8. However, that's not a suitable solution, and still does not work with Mozilla family browsers.
    Eventhought with Mozilla browsers is still not working.
    Is there any restrictions in Java 7 that prevents to read jars from being loaded from local drive when launching Applets?
    Thanks in advance,

    Thank you baftos.
    I had read the whole message before posting mine. It's not the same problem. I'm able to run the sample signed applet always having the jar in the same location than the HTML page serving the applet via JNLP:
    <jar href="SignedAppletTest.jar" main="true"/>
    However, the security exception raises when trying to read that jar from local drive:
    <jar href="file://C:/SignedAppletTest.jar" main="true"/>
    ExitException[ 3]java.lang.SecurityException: Permission denied: file://C:/SignedAppletTest.jar
        at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source)
    I have even tried to decompile JNLP2Manager class, without seeing anything useful on that loadJarFiles method
    The only way I managed to avoid the problem is unchecking the New Generation Plugin and running the Applet with IE. Not a suitable solution for me at all..

  • Signed applet, jmf.jar provided, but no connection

    hi there!
    i'm posting this again in order for you to earn duke-bucks.
    i have a similar problem. i wrote an applet that connects to a video-streamserver an requests a live-stream. the applet sends some udp-packets to the server, which retreives the client's ip from the
    packet and sends it back to the client ( i did this to avoid signing the applet, since otherwise the client
    would have to do a dns-lookup and therefore be signed). the client gets back his public ip (i don't have the 127.0.0.1-problem) , however, i get an
    InvalidSessionAddressException :
    Local Data Address Does not belong to any of the local interfaces
    it seems, the client cannot recognize it's own public ip.
    so i thought, signing the applet would do, but it doesn't.
    I get the same InvalidSessionAddressException.
    now, this only happens on hosts on which jmf is NOT installed.
    Installing the jmf solves the problem. but i don't want people who visit my page having to install
    jmf in order to watch my livestream. i tried including the whole jmf.jar (also tried, customizing it),
    but no success.
    i read the posts on the issue: running jmf-applets on non-jmf-systems, but there seems to be a
    controversy on wether that is possible or not. some say, jmf must be installed, some say, just include jmf.jar or customized jmf.jar.
    what else could i try? i have the clients public ip and i have the applet signed. so, there shouldn't be
    any restrictions anymore.
    i have no ClassDefNotFoundExceptions, so i suppose, including jmf.jar works.
    what else gets changed when i install jmf? there must be some restrictions that keep the vm from
    determining the hosts public ip and which will be removed by the installation of jmf.
    anyone had similar problems? and, perhaps, a solution to this?
    thanks in advance,
    honfrek
    b.t.w. you can earn some duke-bucks too !

    hi!
    i found a very elaborate solution here:
    http://www.mutong.com/fischer/java/usbcam/VideoToAppletWithNoSupport.zip
    this link has been posted before,
    http://onesearch.sun.com/ClickThru?qt=servlets&url=http%3A%2F%2Fforum.java.sun.com%2Fthread.jsp%3Fforum%3D28%26thread%3D515345&pathInfo=%2Fsearch%2Fdevelopers%2Findex.jsp&hitNum=45&col=devforums
    this solution uses jmf only on server side for capturing, then converts the capture-stream into images, splits
    the images into smaller regions and evaluates the differences of these regions to the regions of the previous image. if the difference hits a certain threshold, these regions are transmitted to the applet. but the transmission is done via tcp, which slows things down.
    the splitting -code is hard for me to understand, since i'm new to java.

  • HOW TO RUN THE APPLET IN JAR?

    Hi,
    I have an simple applet . I have created the jar file for the applet using the jar utility.
    1. I would Like to make my applet run simply by double clicking of the jar file.
    2. I have included in the manifest file manifest.inf the main-class file.
    3. When I double click I get the message failed to load the main-class
    Can anyone help
    G.Thirukumaran

    As an Applet does not have a method main, then obviously you need to convert it to an application, which does.

Maybe you are looking for

  • ?Multiple IPod's on one ITunes?

    I am in the process of buying another IPod. I want to know if I would be able to be able to use both IPod's on the same computer. Would they be able to interface with each other?

  • Icloud drive - direct access from an ios device

    Good morning all :-)  Does anyone know if there is some hidden app that allows direct access to iCloud Drive on either an iPad or iPhone?  I know I can open Numbers, Pages, etc and access my iCloud files that pertain to those specific apps, but is th

  • How do I get my apps from my ipad to mac pro

    How do I get my apps from my ipad to macbook pro

  • Light framework and custom iViews

    Does anyone know why the "heavy" framework is used on custom iViews?  We have developed several custom iViews and when we tested them in the light framework, they always pull down the "heavy" framework Javascript.  I created a very simple Hello World

  • Lag on calls and voices sound slow

    Hi all, I have a Sony Xperia Z1 which I've had for a few months. When I make voice calls the person on the other end sounds as if their voice has been slowed down and they complain of delay the same as if they are speaking to someone abroad etc. Has