Applet using java.util.Properties.setPropterty()

Hi,
I'm trying to use the java.util.Properties class in an Applet. More specifically the setProperty(String, String) method. My applet compiles fine but it crashes when I run it with IE (ver. 6). It shows an "NoSuchMethodError: method setProperty(Ljava.lang.String,Ljava.lang.String)". When I compile with javac, it doesn't complain but I guess the IE VM doesn't see that method. But Properties is part of java.util.*, so shouldn't IE have access to that class?
Any help is much appreciated?
Thanks
Heather

The API for that method includes this:
Since:
1.2
That means it's a Java 2 method. The JVM in Internet Explorer doesn't support Java 2 methods (unless you load a plugin that does).

Similar Messages

  • Java.util.properties ? Using Config.getProperty

    Hi all,
    This one has been causing me a bit of a headache! I am using the Java.util.properties to create a file which looks like this:
    #Tue Sep 13 19:15:06 GMT+02:00 2002
    User=tristan
    Password=bristol
    Name=Tristan\ Webb
    Rights=Tristan\ Webb
    #Tue Sep 13 19:15:35 GMT+02:00 2002
    User=adam
    Password=newcastle
    Name=Adam\ Jones
    Rights=Adam\ Jones
    The problem comes when I try to read the information back and put it in a Vector. Using the code below, it only ever puts the last users details (i.e. adam, Newcastle etc..) into the file and skips the first one. I have tried adding more users details, but it only ever reads the last entry. Is there anyway of forcing the config.getProperty to read the first entry in the file and then all the subsequesnt user details ?? I am thinking there must be a way of looping through the file, but im not sure where to start and am quite lost!
    Many Thanks,
    Properties config;
    FileInputStream file;
    file = new FileInputStream("password.cfg");
    config = new Properties();
    config.load(file);
    User2 = config.getProperty("User");
    Password = config.getProperty("Password");
    name = config.getProperty("Name");
    rights = config.getProperty("Rights");
    UserDetails user = new UserDetails(User2, Password, name, rights);
    userDetails.add(user);

    The java.util.Properties class works like a dictionary: it stores values, which you can access using the keys.
    The keys must be unique. In your case, the keys are not unique. If you do: String s = config.getProperty("User"); then how do you expect to get two values back (tristan and adam)?
    You must make the keys unique in some way. For example, write your properties file like this:
    #Tue Sep 13 19:15:06 GMT+02:00 2002
    User.1=tristan
    Password=.1bristol
    Name.1=Tristan\ Webb
    Rights.1=Tristan\ Webb
    #Tue Sep 13 19:15:35 GMT+02:00 2002
    User.2=adam
    Password.2=newcastle
    Name.2=Adam\ Jones
    Rights.2=Adam\ Jones
    Now use for example: String s = config.getProperty("User.1"); to get the name of the first user, etc.
    Jesper

  • Java.util.Properties methods load & store

    Does java.util.Properties methods load & store produce & load platform independent code?

    You mean that it is better to use loadFromXML(InputStream in) and storeToXML(OutputStream os, String comment) methods of this class in order to have platform independent code?

  • Retrofitting java.util.Properties

    Hi all,
    why was java.util.Properties in JDK 1.5 not retrofitted to implement java.util.Map<String,String>?
    This would have been the "natural" way to take advantage of typesafety.
    I'm sure this has something to do with backwards compatibility, but what exactly woud it break?
    Thanks

    java.util.Properties extends java.util.Hashtable
    java.util.Properties : private java.util.HashtableWhat does that actually buy you though?
    I mean its really the difference between:
    class Properties {
        final Hashtable m_contents = new Hashtable();
        public String getProperty(String key) {
                return (String) m_contents.get(key);
    }vs.
    class Properties private extends Hashtable {
        public String getProperty(String key) {
                return (String) super.get(key);
    }Which is nice and all, but it strikes me as syntactic sugar more than anything else.
    I don't disagree: Properties should never have extended Hashtable, it should have encapsulated a Hashtable. Also Stack should not extend Vector, Booleans should not have a public constructor, it would even have been nicer if people actually used the Dictionary interface occassionally in 1.0/1.1.
    Its easy to say these things now with the benefit of 20-20 hindsight.

  • Problem in Creating a jar file using java.util.jar and deploying in jboss 4

    Dear Techies,
    I am facing this peculiar problem. I am creating a jar file programmatically using java.util.jar api. The jar file is created but Jboss AS is unable to deploy this jar file. I have also tested that my created jar file contains the same files. When I create a jar file from the command using jar -cvf command, Jboss is able to deploy. I am sending the code , please review it and let me know the problem. I badly require your help. I am unable to proceeed in this regard. Please help me.
    package com.rrs.corona.solutionsacceleratorstudio.solutionadapter;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.util.jar.JarEntry;
    import java.util.jar.JarOutputStream;
    import java.util.jar.Manifest;
    import com.rrs.corona.solutionsacceleratorstudio.SASConstants;
    * @author Piku Mishra
    public class JarCreation
         * File object
         File file;
         * JarOutputStream object to create a jar file
         JarOutputStream jarOutput ;
         * File of the generated jar file
         String jarFileName = "rrs.jar";
         *To create a Manifest.mf file
         Manifest manifest = null;
         //Attributes atr = null;
         * Default Constructor to specify the path and
         * name of the jar file
         * @param destnPath of type String denoting the path of the generated jar file
         public JarCreation(String destnPath)
         {//This constructor initializes the destination path and file name of the jar file
              try
                   manifest = new Manifest();
                   jarOutput = new JarOutputStream(new FileOutputStream(destnPath+"/"+jarFileName),manifest);
              catch(Exception e)
                   e.printStackTrace();
         public JarCreation()
         * This method is used to obtain the list of files present in a
         * directory
         * @param path of type String specifying the path of directory containing the files
         * @return the list of files from a particular directory
         public File[] getFiles(String path)
         {//This method is used to obtain the list of files in a directory
              try
                   file = new File(path);
              catch(Exception e)
                   e.printStackTrace();
              return file.listFiles();
         * This method is used to create a jar file from a directory
         * @param path of type String specifying the directory to make jar
         public void createJar(String path)
         {//This method is used to create a jar file from
              // a directory. If the directory contains several nested directory
              //it will work.
              try
                   byte[] buff = new byte[2048];
                   File[] fileList = getFiles(path);
                   for(int i=0;i<fileList.length;i++)
                        if(fileList.isDirectory())
                             createJar(fileList[i].getAbsolutePath());//Recusive method to get the files
                        else
                             FileInputStream fin = new FileInputStream(fileList[i]);
                             String temp = fileList[i].getAbsolutePath();
                             String subTemp = temp.substring(temp.indexOf("bin")+4,temp.length());
    //                         System.out.println( subTemp+":"+fin.getChannel().size());
                             jarOutput.putNextEntry(new JarEntry(subTemp));
                             int len ;
                             while((len=fin.read(buff))>0)
                                  jarOutput.write(buff,0,len);
                             fin.close();
              catch( Exception e )
                   e.printStackTrace();
         * Method used to close the object for JarOutputStream
         public void close()
         {//This method is used to close the
              //JarOutputStream
              try
                   jarOutput.flush();
                   jarOutput.close();
              catch(Exception e)
                   e.printStackTrace();
         public static void main( String[] args )
              JarCreation jarCreate = new JarCreation("destnation path where jar file will be created /");
              jarCreate.createJar("put your source directory");
              jarCreate.close();

    Hi,
    I have gone through your code and the problem is that when you create jar it takes a complete path address (which is called using getAbsolutePath ) (when you extract you see the path; C:\..\...\..\ )
    You need to truncate this complete path and take only the path address where your files are stored and the problem must be solved.

  • Finding the key according to string length in java.util.Properties

    Finding the key according to string length in java.util.Properties.
    I know only String length only.

    i need to retrieve the values from the java.util.properties.
    we know that we need to give the key value in order to retrieve the datas.
    but my problem is i will give the length of the key instead of giving the key value but i need to retrieve the datas according to the length of the key.

  • How do I estimate time takes to Zip/Unzip using java.util.zip ?

    If I am compressing files or uncompressing zips using java.util.zip is there a way for me to tell the user how long it should take or for perhaps displaying a progress monitor ?

    For unzip use the ZipInputStream and pass it a CountingInputStream that keeps track ofr the number of bytes read from it (you write this). This CountingInputStream extends fileInputStream and as such can provide you with information about the total number of bytes available to be read and the number already read. This can give a crude idea of how much work has been done and how much work still needs to be done. It is inaccurate but should be good enoough for a progress bar
    As for zipping use the ZipOutputStream and pass it blocks of information. Keep track of the number of blocks you have written and the number you still need to write.
    matfud

  • Using java.util.zip.ZipFile

    I have files that are about 4GB (with possible growth in the future) that will be sent to a file system and a java process will be used to unzip them.
    Is there a size limit for unzipping files using java.util.zip.ZipFile?
    annie

    Chicon wrote:
    Hi annie613,
    Indeed, there's a size limit of 2GB for unzipping files, more precisely when the size of the inflated file reaches 2GB !
    Edit : inflated instead of deflated
    Edited by: Chicon on Jun 29, 2009 3:56 PMHmm, this blog says that the current limit of 4GB has been expanded by implementing ZIP64 support in OpenJDK7 build(b55).
    [http://blogs.sun.com/xuemingshen/entry/zip64_support_for_4g_zipfile]

  • Error in Parser.fx file "incompatible types found   : java.util.Properties"

    Hi,
    In parser file "Parser.fx",
    public-read def PROPERTIES_PARSER = StreamParser {
    override public function parse(input : java.io.InputStream) : RecordSet {
    var props = javafx.util.Properties {};
    props.load(input);
    input.close();
    MemoryRecordSet {
    records: [
    MapRecord {
    fields: props
    due to under line portion an error is appearing:
    "incompatible types
    found : javafx.util.Properties
    required: java.util.Map
    fields: props".
    Please suggest some solution.
    Thanks in advance.
    regards,
    Choudhary Nafees Ahmed
    Edited by: ChoudharyNafees on Jul 5, 2010 3:48 AM

    Parser.fx
    package org.netbeans.javafx.datasrc;
    import javafx.data.pull.PullParser;
    import javafx.data.pull.Event;
    import org.netbeans.javafx.datasrc.MemoryRecordSet;
    public-read def PROPERTIES_PARSER = StreamParser {
        override public function parse(input : java.io.InputStream) : RecordSet {
            var props =java.util.Properties{};
            props.load(input);
            input.close();
            MemoryRecordSet {
                records: [
                    MapRecord {
                        fields: props
    public-read def LINE_PARSER_FIELD_LINE = ".line";
    public-read def LINE_PARSER = StreamParser {
        override public function parse(input : java.io.Reader) : RecordSet {
            var line : String;
            var result : Record [] = [];
            line = readLine(input);
            // BEWARE  ("" == null) is true
            while (line != null or "".equals(line)) {
                var map = new java.util.HashMap();
                map.put(LINE_PARSER_FIELD_LINE, line);
                var record = MapRecord {
                    fields: map
                insert record into result;
                line = readLine(input);
            MemoryRecordSet {
                records: result
    function readLine(in : java.io.Reader) : String {
        var str = new java.lang.StringBuilder;
        while (true) {
            var c = in.read();
            if (c == -1) {
                return if (str.length() == 0) then null else str.toString();
            } else if (c == 0x0D) {
                c = in.read();
                if (c == 0x0A or c == -1) {
                    return str.toString();
                str.append(0x0D);
            } else if (c == 0x0A) {
                return str.toString();
            str.append(c as Character);
        str.toString()
    public-read def JSON_PARSER = StreamParser {
        function toSequence(list : java.util.List) : Record [] {
            var result : Record [] = [];
            var ii = list.iterator();
            while (ii.hasNext()) {
                var r = ii.next() as Record;
                insert r into result;
            result
        override public function parse(input : java.io.InputStream) : RecordSet {
            var topLevel : Object;
            def parser = PullParser {
                documentType: PullParser.JSON
                input: input
                var mapStack = new java.util.Stack();
                var currentMap : java.util.Map;
                var recordsStack = new java.util.Stack();
                var currentRecords : java.util.List;
                var lastEvent: Event;
                onEvent: function(event: Event) {
                    if (event.type == PullParser.TEXT) {
                        currentMap.put(event.name, event.text)
                    } else if (event.type == PullParser.INTEGER) {
                        currentMap.put(event.name, event.integerValue)
                    } else if (event.type == PullParser.NULL) {
                        currentMap.put(event.name, null)
                    } else if (event.type == PullParser.START_ELEMENT) {
                        if (lastEvent.type == PullParser.START_ARRAY_ELEMENT) return;
                        var oldMap = currentMap;
                        var temp = new java.util.HashMap();
                        temp.put(new Object(), null);
                        currentMap = temp;
                        currentMap.clear();
                        mapStack.push(currentMap);
                        if (topLevel == null) topLevel = currentMap;
                        if (oldMap != null) {
                            var mr = MapRecord {
                                fields: currentMap
                            if (event.name == "" and lastEvent.type == PullParser.START_VALUE) {
                                oldMap.put(lastEvent.name, mr)
                            } else {
                                oldMap.put(event.name, mr)
                    } else if (event.type == PullParser.START_ARRAY_ELEMENT) {
                        var temp = new java.util.HashMap();
                        temp.put(new Object(), null);
                        currentMap = temp;
                        currentMap.clear();
                        mapStack.push(currentMap);
                        var mr = MapRecord {
                            fields: currentMap
                        currentRecords.add(mr);
                    } else if (event.type == PullParser.END_ELEMENT) {
                        mapStack.pop();
                        if (not mapStack.empty()) {
                            currentMap = mapStack.peek() as java.util.HashMap;
                        } else {
                            currentMap = null;
                    } else if (event.type == PullParser.END_ARRAY_ELEMENT) {
                        if (lastEvent.type == PullParser.END_ELEMENT) return;
                        mapStack.pop();
                        if (not mapStack.empty()) {
                            currentMap = mapStack.peek() as java.util.HashMap;
                        } else {
                            currentMap = null;
                    } else if (event.type == PullParser.START_ARRAY) {
                        currentRecords = new java.util.ArrayList();
                        recordsStack.push(currentRecords);
                        if (topLevel == null) topLevel = currentRecords;
                    } else if (event.type == PullParser.END_ARRAY) {
                        var set = MemoryRecordSet {
                            records: toSequence(currentRecords)
                        currentMap.put(event.name, set);
                        recordsStack.pop();
                        if (not recordsStack.empty()) {
                            currentRecords = recordsStack.peek() as java.util.List;
                        } else {
                            currentRecords = null;
                    lastEvent = event;
            parser.parse();
            if (topLevel instanceof java.util.Map) {
                var mr = MapRecord {
                    fields: topLevel as java.util.Map
                MemoryRecordSet {
                   records: [mr]
            } else {
                // List
                var rs = MemoryRecordSet {
                    records: toSequence(topLevel as java.util.List)
                rs
            parser.parse();
            var mr = MapRecord {
                fields: topLevel as java.util.Map
            MemoryRecordSet {
               records: [mr]

  • Unzipping files using java.util

    I am trying to unzip files using java.util.zip
    It works fine when I am trying to unzip a file that is already residing on the server.
    But I want to unzip the file that user will upload to the server .
    My code is uploading zip file to server but not able to unzip this zip file giving error
    java.util.zip.ZipException: error in opening zip file
    What could be the problem
    I am not getting exactly
    Can you give me any clue
    Thanks

    sounds like the uploading is the problem. Are you FTPing the file? If so check that it's being transferred in binary, not ascii.

  • Modifying JAR file using java.util.jar package  over the network

    Hello,
    I am modifying a JAR file programmatically using java.util.jar package. The time taken to save the contents to a local disk is very less (around 1 sec) . When I tried modifying the JAR from a remote machine over the network (from mapped drive or shared folder of WIN NT), the time taken to save is 15-20 times more.
    I am recreating the whole JAR while modifying. Is there any way to improve the performance. Or is it possible to write only the changed files?
    Thanks,
    Prasad Y S.

    When you "update" a jar file, you must always recreate it from scratch.

  • Help:how to use java.util.jar to zip or unzip a binary file.

    how to use java.util.jar to zip or unzip a binary file or a file contain native code.

    It may help you to know how I add JARs
    1. I open my Project (myProject)
    2. I Mount the JAR to the FileSystem (like mypackages.jar = which includes com.mus.de.myClass.java)
    3. I Mount the File to the FileSystem (like c:\..myfiles..\myProject)
    3.1 I add the File to my Project
    4. I select File | New -> Classes | Main
    4.1 I typed "import com.mus.de.myClass.java" to refer to this package.
    4.2 I called some of the public methods
    thats it
    Andreas

  • Invalid data returned when iterating a java.util.Properties

    Hi all,
    I'm having trouble iterating thru the values in a java.util.Properties object.
    This problem only occurs when passing in a java.util.Properties object into the constructor of a java.util.Properties.
    Here's some example code. (A picture is worth....)
    <pre>
    import java.util.Properties;
    import java.util.Iterator;
    public class PropertyTest {
    public static void main(String[] args) {
    Properties validProp = new Properties();
    //add some data
    validProp.put("key1", "key1Value");
    validProp.put("key2", "key2Value");
    validProp.put("key3", "key3Value");
    System.out.println("This will iterate...");
    dumpPropertyFile(validProp); //This will iterate correctly
    Properties inValidProp = new Properties(validProp);
    System.out.println("This doesn't iterate correctly");
    dumpPropertyFile(inValidProp); //This will not iterate
    public static void dumpPropertyFile(Properties prop) {
    Iterator iter = prop.keySet().iterator();
    while (iter.hasNext()) {
    String key = (String)iter.next();
    System.out.println(key + "=" + prop.getProperty(key));
    </pre>
    I have searched the bug database, but didn't find any open bugs related to this issue.
    Could someone let me know if this is a existing bug or has this bug already been addressed.
    My setup.
    NT 4.0 / jdk1.3.1
    Thanks,

    I found this works.
    Iterator e = _props.keySet().iterator();
    while(e.hasNext())
    String str = (String)e.next();
    System.out.println("key(" + str + ")=" + _props.getProperty(str));
    but the display sequence is always in descending order ???
    Anyone has a clue ?
    Input :
    catch#2 Prop catch#2
    prop2 Properties.test.2
    catch#6 Prop catch#6
    catch#3 Prop catch#3
    catch#5 Prop catch#5
    catch#4 Prop catch#4
    prop3 test Properties
    prop4 test Properties4
    prop1 Properties.test.1
    catch#1 Prop catch#1
    Output:
    prop4=test Properties4<
    prop3=test Properties<
    prop2=Properties.test.2<
    prop1=Properties.test.1<
    catch#6=Prop catch#6<
    catch#5=Prop catch#5<
    catch#4=Prop catch#4<
    catch#3=Prop catch#3<
    catch#2=Prop catch#2<
    catch#1=Prop catch#1<

  • Unable to validate a java.util.Properties XML based File

    I cannot for the life of me figure out what is wrong with this xml file, but it fails the validation of java.util.Properties and as such won't be parsed in. Help!
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
    <properties version="1.0">
      <entry key="bottleneckServer.address"></entry>
      <entry key="bottleneckServer.port">8206</entry>
      <entry key="bottleneckServer.confirmDelay">10</entry>
      <entry key="bottleneckServer.cleanupDelay">120</entry>
    </properties>Thanks in advance!

    This xml file works perfectly.
    Here is some test code:
            Properties p = new Properties();
            p.loadFromXML(getClass().getClassLoader().getResourceAsStream("someFilePath/someFileName.xml"));
            assert "8206".equals(p.getProperty("bottleneckServer.port")) : "Property 'bottleneckServer.port' != 8206";

  • How can I use java.util.Date and change display format.

    Hello All,
    I want to use java.util.Date in View Context and in Custom Control Context of Web dynpro java. When i mapped of a Input Field to the java.util.Date then message shows that its not supported. Plz suggest me how to handle Date with different formats ??

    If you always want the user to enter the date in dd/MM/yyyy, you can do the following.
    Goto Local Dictonary -> Simple types in your project and create a type known as "InputDate" (or whatever you feel) of built-in type 'Date'.
    Now specifiy its format in the 'Representation' tab as "dd/MM/yyyy" (case-senstive).
    Now declare a value attribute say "inputdate" in your context with this type and bind the inputfield to this context value attribute.
    This will solve your problem.
    But if you want the user to input date depending on the region he belongs, change the default locale date in Control Panel->Regional and Language Options->Change to English(UK) -> Customize -> Date Tab -> Sort Date Format to dd/MM/yyyy.
    Now clear the cache, delete temporary files and restart the machine. This should solve the problem.

Maybe you are looking for