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

Similar Messages

  • How can I pass value in status and reason for rejection using BAPI_LEAD_CREATEMULTI when creating multiple lead

    Hello,
    I want pass value in STATUS and Reason for rejection according to requirement when i am creating multiple lead using BAPI_LEAD_CREATEMULTI. Please help me how can i pass value. Please give some sample code that in which table i have to pass values and please also tell me INPUT_FIELDS values. Please help me
    Regards,
    Kshitij Rathore

    Hello,
    Please help me for solve this problem. I am trying to solve problem from last 4 days but i didn't get any solution.
    Regards,
    Kshitij Rathore

  • 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.

  • 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.

  • How can I pass values from one node to another

    Give a standard and efficient way to pass values from child to parent

    hai Prathap
    You can use the custom event  for passing values from child to parent

  • How can I pass value from sql query to unix script

    I am new to oracle/unix.
    I want to write a simple script to find max date from a table and then pass date into a variable in a korn shell script.
    sql is select max(date) from table;
    how can I pass that value in unix shell as a variable. Thanks

    I use to code like this.
    Enjoy Scripting.
    cmd.sql
    select sysdate from dual;
    exit
    db.sh
    #! /usr/bin/ksh
    . ~oracle/.orapaths
    dbdate=$(sqlplus -S user/pwd@servicename @cmd.sql)
    echo $dbdate
    Run shell scripts
    ./db.sh
    SYSDATE --------- 19-JAN-07

  • Can we pass values to custom headers through HTTP bindings in BPEL?

    hi,
    I have an urgent requirement where I have to pass values to custom headers of HTTP url through HTTP bindings in bPEL.
    Is it possible? Say I have a http url http://localhost:80/test.
    I need to post xml over the above HTTP url as well pass some values to the Custom Headers Variables.
    Can I achieve this functionality thorugh BPEL or not?

    Hi,
    My requirement is exactly the same as yours, can you please let me know what did you do to overcome the Oracle Forms Default change password screen.
    Regards,
    Praveen

  • Can we pass values when hyperlinking a classic report column?

    Version 4.2.1 (builder blue)
    Hi there,
    I have a classic report in which I have hyperlinked a column, using the standard link option in the report settings. In that we can also pass on values to to page that the linked report opens. However, I notice when I pop up the window for the value to be passed, it only lists the #XY# contents of the report. Lets say, I have created the link on page1 which when clicked opens Page 2,
    I want to pass the value of :P1_PERIOD to :P2_PERIOD
    Can we not do that through the link? If I just put the value in Item1 as P2_PERIOD and populate it with :P1_PERIOD, wouldn't that work?
    Thanks,
    Ryan

    ryansun wrote:
    Version 4.2.1 (builder blue)
    Hi there,
    I have a classic report in which I have hyperlinked a column, using the standard link option in the report settings. In that we can also pass on values to to page that the linked report opens. However, I notice when I pop up the window for the value to be passed, it only lists the #XY# contents of the report. Lets say, I have created the link on page1 which when clicked opens Page 2,
    I want to pass the value of :P1_PERIOD to :P2_PERIOD
    Can we not do that through the link?Yes, you can, but not using that syntax.
    If I just put the value in Item1 as P2_PERIOD and populate it with :P1_PERIOD, wouldn't that work?No, <tt>:P1_PERIOD</tt> is referencing the item using bind variable notation. That's only for use in SQL and PL/SQL contexts within APEX. Elsewhere in APEX (HTML source, links and branches etc) you need to reference item values using static text substitution:
    &P1_PERIOD.(Note the terminating dot.)
    Put <tt>P2_PERIOD</tt> in Item 1 Name and <tt>&P1_PERIOD.</tt> in Value.

  • Can we Pass value from PDK to Webdynpro

    Hi ,
    Can we pass the values from PDK to webdynpro screen.I have created a screen in PDK , i want to send the control to the webdynpro application on some action.
    whether is it possible ? if yes tel me how to go about that .
    Rakesh

    Hi Rakesh ,
    We can pass value the concept of following comes into picture :-
    · dataObject
    This parameter contains the transported parameter of the portal event.
    · Namespace
    This parameter contains the name space of the received portal event.
    · Name
    This parameter contains the name of the received portal event.
    Refer to this for more details  :-
    http://help.sap.com/saphelp_erp2005/helpdata/en/5d/08f43cf1da7646a2b210a16321c669/content.htm
    Thanks & Regards
    Pankaj

  • Can we pass value of variable in Authorware5.2 to Flash 5

    Hi,
    I want to pass value of one variable which is in the
    Authorware5.2 to Flash 5. Depending on that value i want to
    duplicate the Movie clip.
    Is it possible and How?
    Thanks in advance.

    I urge you to look at the documentation for the Flash sprite
    as it will
    answer your question. #property can be a range of values.
    Place a Flash sprite, get its properties, click the Options
    button,
    click Help...
    Erik
    Jeevan_N_Salunke wrote:
    > Hi,
    > Using SetSpriteProperty(@"SpriteIconTitle", #property,
    value) we can changes
    > the properties of Sprite, but I want to pass one value
    to Flash 5 i.e. Sprite
    > and depending on that value I want to do some
    processing.
    >
    > For Example.
    > Suppose Flash file contain Dynamic text box who's
    variable name is "my_txt"
    > and when i load the Sprite Icon or by clicking on button
    displays the Sprite,
    > at that time i want to pass some txt to that (my_txt)
    variable.
    >
    > Please suggest me the solution.
    >
    >
    Erik Lord
    http://www.capemedia.net
    Adobe Community Expert - Authorware
    http://www.macromedia.com/support/forums/team_macromedia/
    http://www.awaretips.net -
    samples, tips, products, faqs, and links!
    *Search the A'ware newsgroup archives*
    http://groups.google.com/groups?q=macromedia.authorware
    *The Blankenship Caveat: Note that direct linking to http
    content
    through any Authorware icon will likely fail if a proxy
    server is present!*

  • Can we pass value through "EXPORT" in background scheduled report

    hi experts
          my query is can we pass some field using 'EXPORT' statement while scheduling a report to run in background using statement
    submit 'ZXYX' via job jo_name number jo_num and return.
    i am using 'IMPORT" statement in 'ZXYZ'

    EXPORT, as I recall, is limited to your user context.   Check shared objects (which still may not work, although you can propagate to servers) and INDX-like tables.  Research use of INDX-like tables for how data is passed into and out of these tables (import/export).

  • Can't load sql file from inside jar file?

    hi all
    i have a sql file inside my jar file
    and i want to get the path of the sql file to use it in runtime command to restore a sql dump file
    i used the following but it doesn't work:
    the path contains invalid characters such %20% instead of and?
    URL url2=getClass().getResource("backup.sql");
    String str1=url2.toString().substring(10);
    String command="cmd.exe /c  c:\\wamp\\mysql\\bin\\mysql -u root --password=anasa library < "+str1;       
    Runtime.getRuntime().exec(command);is this way is wrong?
    or there's an alternative way?

    How is the system to pull the data out of the jarfile?
    That redirection symbol means to take the information from the file, or here document, or command output that comes after it, but you don't have any of those. It will read that String as if it is a file name, but a file under that name doesn't exist. And, after you've changed it like you have, it doesn't even reference anything inside of a jar file anymore (not that the command could have used that anyway).
    If you insist on doing something like this, then you are going to need to read it with getInputStream and write it out somewhere (probably to a temp file) then use that tempfile and delete it when you're done.

  • 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.

  • Validating xml-files inside jar-files  for JWS

    I want to use xml-files inside a jar-file and want to validate them with dtd-files,
    located in the same jar-file. This does work, but only as long as the dtd-file is
    in the same directory as the xml-file.
    For example, I have no problem, with a DOC Type-statement like
    <!DOCTYPE questestinterop SYSTEM "ims_qtiv1p1.dtd" >
    With this statement, however, one needs an approprate dtd in every directory containing an XML-file of that type.
    If however i want to gather the necessary dtd's in a directory one (or more) levels above with a DOCTYPE-statement of the form
    <!DOCTYPE questestinterop SYSTEM "../ims_qtiv1p1.dtd" >
    I get error messages of the form
    java.io.FileNotFoundException: JAR entry Mikro/Marshall/BookQuestions/../ims_qtiv1p1.dtd not found in C:\Dokumente und Einstellungen\wreiss\Anwendungsdaten\Sun\Java\Deployment\javaws\cache\http\Dwiwi.upb.de\P80\DM~vwl08\DMOViSS\DMoviss_current\RMMikro.jar
         at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
         at org.apache.crimson.parser.Parser2.externalParameterEntity(Unknown Source)
         at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Unknown Source)
         at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
         at org.apache.crimson.parser.Parser2.parse(Unknown Source)
         at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
         at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(Unknown Source)
         at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
         at oviss.competenceCenter.XMLExpert.setElements(XMLExpert.java:245)
    though the dtd-file is in the parent-directory (inside the jar) and the unpacked xml-file can be successfully validated.
    Why does this happen. How can one use a single dtd for multiple xml-files (of the same type) in different directories?.
    Thanks
    Winfried Reiss

    In reply to myself, replacing the HTMLBrowser constructor with this;
    public HTMLBrowser()
                  URL url;
                  try
                       // Construct the URL
                       url= this.getClass().getResource('/'+dir+'/'+startPage);
                       setPage(url);
                  catch (Exception e)
                  System.out.println( "Problem setting help homepage");
                 setEditable(false);
                 addHyperlinkListener(new LinkListener(this));
            }made it work. This is because seemingly you need '/' at the start of the resouce's path and '/' as the separator, regardless of platform.
    I hope this helps someone else.
    John

  • How to protect the class files inside jar file.

    Hi Group,
    pls help me.
    my need is i created a executable jar file with certain classes.
    and i'm supposed to send it to my client.
    but if the client needs he can extract the class files from the jar and with the
    help of some decompilers he can convert class file to .java source code and read the whole
    stuff.
    how can i protect my jar file from these.
    is there any security mechanism for that
    pls help me.
    Regards,
    Ranjith.M

    In order to protect my jar file I tried the jar signer technology but it only protects the jar from modification so I need to know how to protect jar file from decoding of the contents inside.

Maybe you are looking for