Sort(java.util.LinkedList java.lang.Object ) doesn't work

Why doesn't this work?
LinkedList<Object> sysPropsKeys = new LinkedList<Object>(System.getProperties().keySet());
Collections.sort(sysPropsKeys);
cannot fnd symbol
symbol : method sort(java.util.LinkedList<java.lang.Object>)
location: class java.util.Collections

I will admit to not having Java1.5 installed on my machine. Haven't yet had the chance to play with generics, but the above DOES work in 1.4, and SHOULD work in 1.5
Maybe I'm naive but, System.getProperties() returns a Properties object right?
According to the API: http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html: Each key and its corresponding value in the property list is a string.
All the keys SHOULD be strings.
AFAIK string are comparable, and shouldn't throw class cast exceptions
Thus the keys returned from getProperties SHOULD be comparable, and compatible for comparision.
Ok, I can see your point in that some hackers abuse the Properties class by putting non string keys/values into the Properties Map. In that case the code would become more like your above. I'd probably still go with a TreeMap though, rather than a sorted list of keys. Most time you want the keys, you want the values as well. So if the intention is to print out a sorted list of system properties, and their values, keeping it in a map is best.
Just my 2 cents,
evnafets

Similar Messages

  • Need node-level access in java.util.LinkedList... possible?

    Hi, I require access to the nodes not the elements, in a java.util.LinkedList. Is this possible, or will I have to write my own implementation.
    Thanks
    Grape

    I do need full control over the nodes because I am linking them together to form an n-dimensional circularly-linked lattice. After thinking about it, it became clear it would be much easier to write my own nodes and special type of iterator along with an Axis enum type than it would be to muck around trying to weave together prefab lists even if I did have access to the nodes. Anyways, the feat has been accomplished :) Thanks for your reply.

  • Date object doesn't work in query filters

    I'm trying to create a universe object called Next Biweekly Pay End Date.  Some background: there is an end date for our biweekly payrolls every 14 days, and the logic behind the object is basically that if there was a biweekly pay end date 7 days ago, the next one is 7 days from today (that is, sysdate + 7), etc.</p>
    I have it working so that it displays the correct date when used in a WebI report.  However, when I use it in a query filter in a WebI report (like, Pay End Date = Next Biweekly Pay End Date), I don't get an error, but I also don't get any data.  Somehow my object doesn't work in a query filter.  The purpose of the object is for use in query filters, so I need to get this to work.</p>
    My best guess about why it doesn't work in a query filter is due to some issue with the data type.  Pay End Date has a data type of date in the universe.  I gave Next Biweekly Pay End Date a data type of date also, but the query filter still doesn't work; I get "no data to fetch."</p>
    We're using XI 3.1.6 and Oracle 10.  Any ideas about how to get this to work?</p>
    If it helps, here is the definition of Next Biweekly Pay End Date.  The logic is that it takes today's date, subtracts Oct. 31, 2009 (a biweekly pay end date), divides by 14, and looks at the remainder.  If the remainder is 0, then today is a pay end date and the next one is 14 days from now.  If the remainder is 1, yesterday was a pay end date and the next one is 13 days from now, etc.</p>
    case</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 0 then (sysdate + 14)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 1 then (sysdate + 13)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 2 then (sysdate + 12)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 3 then (sysdate + 11)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 4 then (sysdate + 10)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 5 then (sysdate + 9)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 6 then (sysdate + 8)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 7 then (sysdate + 7)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 8 then (sysdate + 6)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 9 then (sysdate + 5)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 10 then (sysdate + 4)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 11 then (sysdate + 3)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 12 then (sysdate + 2)</p>
      when mod((trunc(sysdate)) - (to_date('31/10/2009')),14) = 13 then (sysdate + 1)</p>
    end

    Thanks for the suggestions.
    I did some more testing, and there seems to be something more complicated going on.  I ran the following code in SQL*Plus:
    SELECT distinct M_PYDW1.PYSTATUS.DW_OWNER,
    case
    when to_date(sysdate, 'dd/mm/yyyy hh24:mi:ss') >= to_date('01/01/2010','dd/mm/yyyy hh24:mi:ss') then To_Date((sysdate - 2),'dd/mm/yyyy')
    else to_date(sysdate +2, 'dd/mm/yyyy')
    end
    FROM M_PYDW1.PYSTATUS
    The condition should be true, because the sysdate (today is Jan. 20) is greater than 1/1/2010, so I should get a result of sysdate - 2 (Jan. 18).  But the result I get is Jan. 22 (sysdate +2).  It seems that the comparison is failing even though I'm formatting both sysdate and 1/1/2010 as dates with a timestamp.  What could cause that?
    One more mystery: when I run the same code as above in a WebI report (using custom SQL), I get the error ORA-1830, date format picture ends before converting entire input string.

  • Archive Utility's option "save in" doesn't work

    Archive Utility's option "save in" doesn't work in Finder. Even I use its .prefPane and set it there…
    I only want all my archives created with Finder are saved on the Desktop…
    What's wrong with Mac OS X?

    I think I found it. It's look like a bug in Mac OS X…
    Look at my screenshot. There should be "archive-into" instead of "archive-info" (like in "dearchive-into")?

  • Java.util.Map to as object

    Hi,
    I want to get java.util.Map object returned from server-side
    on the client-side. I don't know which flex data-type should I use
    for that. I tried Array but it dint help. Someone plz help...
    Thanks in advance,
    Cheree

    You can use a for-in ActionScript loop to examine any
    ActionScript Object:
    for(var i:String in someObject) {
    trace( i+" = "+someObject
    Within the loop, i assumes the name of all the public
    properties in the given object.

  • Java.util.zip java.util.jar API usage

    I have been trying unsuccessfully for the past two days to be able to programatically add and extract files into and from a JAR using the API. I haven't found any API docs that cover the basics and I have been stumped using the nuggets that I have found on the Forum so far. Below is the code so far. Feel free to use what works in your programs, but if you find out how to get this to work. Sorry for the long post, but I gather this is a common problem that needs to be solved.
    ___________JAR CLASS_______________
    import java.io.*;
    import java.util.*;
    import java.util.jar.*;
    import java.util.zip.*;
    public class Jar {
        public Jar() {
        public boolean copyToJar(File[] sources, File destination) {
            if (destination == null) {
                return false;
            if (nameContainsWildcards(destination)) {
                return false;
            File[] sourceArray = expandWildcards(sources);
            if (sourceArray == null) {
                System.out.println("sourceArray was empty");
                return false;
              System.out.println("Ready to add " + sourceArray.length + " files to " + destination);
              //variables for copying the old destination file to the new destination
              File tmpFile = null;
              JarFile tmpJarFile = null;
              InputStream jarInput = null;
              JarInputStream jarIn = null;
            InputStreamReader jarDataFile = null;
              //variables for the destination
            OutputStream output = null;
            JarOutputStream jarOut = null;
            File input = null;
            FileInputStream dataFile = null;
            int buf = -1;
              if (destination.exists()) {
                   System.out.println("The destination file exists");
                   //copy the destination to temporary
                   //fix copyToJar to use the same .tmp file name as the destination (for reentrant code)
                   tmpFile = new File(destination.getParent() + "\\" + "jar.tmp");
                   if (tmpFile.exists()) {
                        tmpFile.delete();
                   //rename the original to the TempFile
                   destination.renameTo(tmpFile);
                   if (destination.exists()) {
                        destination.delete();
                   try {
                        tmpJarFile = new JarFile(tmpFile);
                   } catch (IOException ioe) {
                        System.out.println("Exception while creating JarFile " + ioe );
            try {
                   //initialize the destination
                output = new FileOutputStream(destination);
                jarOut = new JarOutputStream(output);
                   //if there is a tmpFile copy contents of tmpFile to the new destination
                   if (tmpFile != null) {
                        jarInput = new FileInputStream(tmpFile);
                        jarIn = new JarInputStream(jarInput);
                        ZipEntry ze = null;
                        boolean contains = false;
                        while((ze = jarIn.getNextEntry()) != null) {
                             System.out.println("Working on zipEntry " + ze.getName());
                             contains = false;
                             for (int i=0; i<sourceArray.length; i++) {
                                  if (ze.getName().compareToIgnoreCase(sourceArray.getName()) == 0) {
                                       contains = true;
                             if (contains == false) {
              jarDataFile = new InputStreamReader(tmpJarFile.getInputStream(ze));
                                  System.out.println("The zip Entry was copied from the old file");
                                  jarOut.putNextEntry(ze);
                                  buf = -1;
                                  buf = jarDataFile.read();
                                  while (buf != -1) {
                                       jarOut.write(buf);
                                       buf = jarDataFile.read();
                                  jarOut.closeEntry();
                                  jarDataFile.close();
                        jarIn.close();
                        jarInput.close();
                        tmpFile.delete();
                        tmpJarFile.close();
                   //copy the new files to the destination
    for (int i=0; i<sourceArray.length; i++) {
    if (sourceArray[i].isDirectory()) {
                             //fix copyToJar to copy entire directory if the directory is given as a source
    } else {
    System.out.println("Adding " + sourceArray[i].getAbsolutePath() + " to "
    + destination.getAbsolutePath());
    dataFile = new FileInputStream(sourceArray[i]);
    ZipEntry entry= new ZipEntry(sourceArray[i].getName());
    jarOut.putNextEntry(entry);
    buf = -1;
    buf = dataFile.read();
    while (buf != -1) {
    jarOut.write(buf);
    buf = dataFile.read();
    jarOut.closeEntry();
    jarOut.close();
    output.close();
    dataFile.close();
    } catch (IOException ioe) {
    System.out.println("Exception " + ioe + " occured while writing the backup jar file.");
    try {
    if (jarOut != null)
    jarOut.close();
    if (output != null)
    output.close();
    if (dataFile != null)
    dataFile.close();
    if (jarInput != null)
    jarInput.close();
    if (jarIn != null)
    jarIn.close();
    } catch (IOException ioe2) {
    System.out.println("Exception " + ioe2 + " closing the jar file.");
    return false;
    return true;
    public boolean copyToJar(File source, File destination) {
    File[] sourceArray = expandWildcards(source);
    if (sourceArray == null) {
    System.out.println("sourceArray was empty");
    return false;
    return copyToJar(sourceArray, destination);
         public boolean extractFromJar(File source, File extract, File destDirectory) {
              try {
                   JarFile jarIn = new JarFile(source);
                   ZipEntry ze = jarIn.getEntry(extract.getName());
                   if (ze == null) {
                        System.out.println("Could not find file " + extract + " in jarFile " + source);
                   } else {
                        JarInputStream jarInput = null;
                        InputStreamReader buf = null;
                        FileOutputStream out = null;
                        InputStream in = jarIn.getInputStream(ze);
                        buf = new InputStreamReader(in);
                        out = new FileOutputStream(extract);
                        int buffer = -1;
                        buffer = buf.read();
                        while (buffer != -1) {
                             out.write(buffer);
                             buffer = buf.read();
              } catch (IOException ioe) {
                   System.out.println("Could not extract the file " + extract + " from jarFile " + source);
                   return false;
              return true;
    public int numberOfLines(File fileToCount) {
    int num = 0;
    try {
    FileReader regRead = new FileReader(fileToCount);
    LineNumberReader regReadLine = new LineNumberReader(regRead);
    while (regReadLine.readLine() != null) {
    num = regReadLine.getLineNumber();
    regRead.close();
    regReadLine.close();
    } catch (IOException ioe) {
    System.out.println("Exception " + ioe + " occured in " + this.getClass().getName());
    return num;
    static public boolean nameContainsWildcards(File source) {
    if (source != null) {
    if ((source.getName().indexOf('*')) >=0) {
    return true;
    //fix this check to look for other wildcards
    return false;
    * Expands the * wildcard that does not start the expression. For example,
    * in a directory whose contents are TEST1.DAT, TEST2.DAT AND TEST3.DAT, this
    * funtion will return the following based on the input
    * Input Returns
    * TEST1.DAT File[] containing the first file
    * TEST*.DAT File[] containing all three files plus any that match TEST*.*
    * T*.* File[] containing all three files plus any that match T*.*
    * *.* File[] containing all three files plus any that match *.*
    * EST.DAT File[] containing no files (not a legal expression...yet)
    * ? or
    public File[] expandWildcards(File source) {
    if (source == null) {
    System.out.println("Cannot expand wildCards for a null File");
    return null;
    File[] sourceArray = null;
    if (nameContainsWildcards(source)) {
    FileFilter wildcardFilter = new WildcardFilter(source.getName());
    File sourceParent = new File(source.getParent());
    if (sourceParent != null) {
    sourceArray = sourceParent.listFiles(wildcardFilter);
    } else {
    sourceArray = new File[1];
    sourceArray[0] = source;
    } else {
    sourceArray = new File[1];
    sourceArray[0] = source;
    return sourceArray;
    public File[] expandWildcards(File[] sources) {
    File[] sourceArray = null;
    List fileArrays = new ArrayList();
    for (int i=0; i< sources.length; i++) {
    fileArrays.add(expandWildcards(sources[i]));
    int totalFiles = 0;
    for (int i=0; i < fileArrays.size(); i++) {
    File[] tmp = (File []) fileArrays.get(i);
    if (tmp != null) {
         //System.out.println("Adding " + tmp.length + " to total files");
         totalFiles += tmp.length;
    System.out.println("totalFiles expanded = " + totalFiles);
    sourceArray = new File[totalFiles];
    int nextIndex = 0;
    for (int i=0; i < fileArrays.size(); i++) {
    File[] tmp = (File []) fileArrays.get(i);
    if (tmp != null) {
                        for(int j=0; j < tmp.length; j++) {
                             //System.out.println("Adding file " + tmp[j] + " to sourceArray");
                             sourceArray[nextIndex] = tmp[j];
                             nextIndex++;
    return sourceArray;
    static public void main(String argv[]) {
    Jar jarRun = new Jar();
    File testFile = new File("D:\\test.jar");
              File testFile1 = new File("C:\\Program Files\\RBusinessSystems\\Location Sync\\LONGMONT\\LongmontDefaultCustomers.jar");
              File testFile2 = new File("C:\\Program Files\\RBusinessSystems\\Location Sync\\LONGMONT\\LongmontDefaultInventory.jar");
              File testFile3 = new File("C:\\Program Files\\RBusinessSystems\\Location Sync\\LONGMONT\\LongmontDefaultVendors.jar");
              File testFile4 = new File("C:\\Program Files\\RBusinessSystems\\Location Sync\\LONGMONT\\LongmontDefaultClerks.jar");
              if (argv.length >= 1) {
                   System.out.println("Creating the Jar File");
                   jarRun.copyToJar(testFile1, testFile);
                   jarRun.copyToJar(testFile2, testFile);
                   jarRun.copyToJar(testFile3, testFile);
                   jarRun.copyToJar(testFile4, testFile);
              } else {
                   System.out.println("Extracting from the Jar File");
                   jarRun.extractFromJar(testFile, new File("d:\\LongmontDefaultCustomers.jar"), new File("d:\\"));
                   jarRun.extractFromJar(testFile, new File("d:\\LongmontDefaultInventory.jar"), new File("d:\\"));
                   jarRun.extractFromJar(testFile, new File("d:\\LongmontDefaultVendors.jar"), new File("d:\\"));
                   jarRun.extractFromJar(testFile, new File("d:\\LongmontDefaultClerks.jar"), new File("d:\\"));
    ______________WILDCARD FILTER CLASS __________
    import java.io.File;
    import java.io.FileFilter;
    public class WildcardFilter implements FileFilter {
        private String compare = null;
        private String wildcardStart = null;
        private String wildcardMiddle = null;
        private String wildcardEnd = null;
        WildcardFilter(String comparison) {
            setCompare(comparison);
        public void setCompare(String comparison) {
            compare = comparison.toLowerCase();
            wildcardStart = null;
            wildcardMiddle = null;
            wildcardEnd = null;
            int index = compare.indexOf('*');
            if (index != -1) {
                wildcardStart = compare.substring(0, index);
                if (index + 1 < compare.length()) {
                    wildcardEnd = compare.substring(index + 1, compare.length());
                System.out.println("Expanding fileNames starting with " + wildcardStart
                          + " and ending with " + wildcardEnd);
        public boolean accept(File check) {
            String checkName = check.getName().toLowerCase();
            if (compare == null) {
                return false;
            if (((wildcardEnd == null) || (wildcardEnd.compareTo("") == 0))
                && ((wildcardStart == null) || (wildcardStart.compareTo("") ==0))) {
                return false;
            if (((wildcardStart == null) || (wildcardStart.compareTo("") ==0))
                && (wildcardEnd != null)) {
                if ((wildcardEnd.compareTo(".*") ==0) || (wildcardEnd.compareTo("*") == 0))
                    return true;
                if (checkName.endsWith(wildcardEnd))
                    return true;
            if (((wildcardEnd == null) || (wildcardEnd.compareTo("") == 0))
                && (wildcardStart != null)) {
                if (checkName.startsWith(wildcardStart))
                    return true;
            if ((checkName.startsWith(wildcardStart))
                && (checkName.endsWith(wildcardEnd))) {
                return true;
            return false;

    I figured it out based on some of the other posts I found on this Forum. Following is the working code. While this code is not as robust as it needs to be for production, it will at least get you started on extracting from jar files and writing to jarfiles.
    import java.io.*;
    import java.util.jar.*;
    import java.util.zip.*;
    //NOTE: You can only copy entries created by the Jar tool
    class JarTest {
        JarTest() {
        public boolean copyToJar(File[] fileList, File jarFile) {
            JarEntry je = null;
            File tmpFile = null;
            FileOutputStream fos = null;
            JarOutputStream jos = null;
            BufferedWriter bw = null;
            FileInputStream fis = null;
            JarInputStream jis = null;
            BufferedReader br = null;
            int buf = -1;
            boolean badZipFile = false;
            boolean refreshFromNewFile = false;
            String tmpFileName = jarFile.getAbsolutePath() + ".tmp";
            try {
                tmpFile = new File(tmpFileName);
                fos = new FileOutputStream(tmpFile);
                jos = new JarOutputStream(fos);
                bw = new BufferedWriter(new OutputStreamWriter(jos));
            } catch (IOException ioe) {
                ioe.printStackTrace();
        if(jarFile.exists()) {
                try {
                    fis = new FileInputStream(jarFile);
                    jis = new JarInputStream(fis);
                    br = new BufferedReader(new InputStreamReader(jis));
                } catch (IOException ioe) {
                    System.out.println(ioe);
                try {
                    while((je = jis.getNextJarEntry()) != null) {
                        refreshFromNewFile = false;
                        for (int i = 0; i < fileList.length; i++) {
                            if (je.getName().compareToIgnoreCase(fileList.getName()) == 0) {
    refreshFromNewFile = true;
    if (refreshFromNewFile) {
    //do nothing so we can add the new file below
    } else {
    jos.putNextEntry(je);
    int index = 0;
    buf = -1;
    while((buf = br.read()) != -1) {
    bw.write(buf);
    index++;
    System.out.println("Copied entry " + je.getName() + " of " + index + " bytes from " + jarFile.getName());
    bw.flush();
    jos.closeEntry();
    } catch (IOException ioe) {
    ioe.printStackTrace();
    badZipFile = true;
    try {
    br.close();
    jis.close();
    fis.close();
    } catch (IOException ioe) {
    ioe.printStackTrace();
    for (int i = 0; i < fileList.length; i++) {
    try {
    fis = new FileInputStream(fileList[i]);
    br = new BufferedReader(new InputStreamReader(fis));
    // write the new entries to the tmpFile
    je = new JarEntry(fileList[i].getName());
    jos.putNextEntry(je);
    int index = 0;
    buf = -1;
    while((buf = br.read()) != -1) {
    bw.write(buf);
    index++;
    bw.flush();
    System.out.println("Added entry " + je.getName() + " of " + index + " bytes.");
    jos.closeEntry();
    } catch (IOException ioe) {
    ioe.printStackTrace();
    badZipFile = true;
    try {
    jos.close();
    if (tmpFile != null) {
    // rename the tmpFile to jarFile
    jarFile.delete();
    tmpFile.renameTo(jarFile);
    } catch (IOException ioe) {
    ioe.printStackTrace();
    return true;
    public boolean extractFromJar(File[] fileList, File jarFile) {
    ZipEntry zen = null;
    BufferedReader br = null;
    FileOutputStream fos = null;
    BufferedWriter bw = null;
    try {
    for (int i = 0; i < fileList.length; i++) {
    JarFile jar = new JarFile(jarFile);
    zen = jar.getEntry(fileList[i].getName());
    if (zen == null) {
    System.out.println("Could not find the file " + fileList[i].getName() + " in the zip file " + jar.getName());
    } else {
    File parentDirectory = new File(fileList[i].getParent());
    parentDirectory.mkdirs();
    InputStream in = jar.getInputStream(zen);
    br = new BufferedReader(new InputStreamReader(in));
    fos = new FileOutputStream(fileList[i]);
    bw = new BufferedWriter(new OutputStreamWriter(fos));
    int buf = -1;
    int index = 0;
    while((buf = br.read()) != -1) {
    bw.write(buf);
    bw.flush();
    index++;
    System.out.println("Extracted file " + fileList[i] + " of " + index + " bytes from " + jarFile);
    br.close();
    bw.close();
    } catch (IOException ioe) {
    System.out.println(ioe);
    return false;
    return true;
    public static void main(String[] argv) {
    JarTest jt = new JarTest();
    File jarFile = new File("d:\\test\\test.zip");
    File[] fileList1 = new File[] {new File("d:\\test\\CustomerRefreshRequest.bat"),
                                            new File("d:\\test\\CustomerUpdateGet.bat"),
                                            new File("d:\\test\\CustomerUpdateRequest.bat"),
                                            new File("d:\\test\\LongmontDefaultClerks.jar"),
                                            new File("d:\\test\\LongmontDefaultCustomers.jar"),
                                            new File("d:\\test\\LongmontDefaultInventory.jar")};
    File[] fileList2 = new File[] { new File("d:\\test\\install.bat"),
    new File("d:\\test\\LongmontDefaultVendors.jar"),
    new File("d:\\test\\CustomerUpdateSend.bat") };
    jt.copyToJar(fileList1, jarFile);
    jt.copyToJar(fileList2, jarFile);
    File[] fileList3 = new File[] {new File("d:\\test\\temp\\CustomerRefreshRequest.bat"),
                                            new File("d:\\test\\temp\\CustomerUpdateGet.bat"),
                                            new File("d:\\test\\temp\\CustomerUpdateRequest.bat"),
                                            new File("d:\\test\\temp\\LongmontDefaultClerks.jar"),
                                            new File("d:\\test\\temp\\LongmontDefaultCustomers.jar"),
                                            new File("d:\\test\\temp\\LongmontDefaultInventory.jar")};
    File[] fileList4 = new File[] { new File("d:\\test\\temp\\INSTALL.BAT"),
    new File("d:\\test\\temp\\LongmontDefaultVendors.jar"),
    new File("d:\\test\\temp\\CustomerUpdateSend.bat") };
    jt.extractFromJar(fileList3, jarFile);
    jt.extractFromJar(fileList4, jarFile);

  • Conversions between java.util.Date, java.util.Timestamp and java.sql dates

    I am coding a hoilday booking system using JSP to interact with a SQL Server database. On my JSP form which retrieves the information I have a little javascript pop-up date selector which appears to be returning a Timestamp value although the string value is visable in the entry field. Can I pass this to a javabean as a Timestamp, so far I have only passed strings? Also I then have to enter it in the database and so will need to convert it to an sql date type but I dont know which one is best. Previous to using the Timestamp returning calendar I was just entering text and parsing it to a util.Date in the bean and then converting that to an sql.Date for entry in the database. That worked fine but I want to use the pop-up any ideas? Also my bean won't compile if I declare java.util.Timestamp t;(cannot resolve symbol Timestamp !) even though I have imported util.

    First of all, java.util.Timestamp does not exist. You probably need java.sql.Timestamp.
    java.sql.Date and java.sql.Timestamp inherit from java.util.Date. So converting from java.sql.Date or java.sql.Timestamp to java.util.Date is easy, you don't have to do anything.
    To convert a java.util.Date to a java.sql.Timestamp, do something like this:
    import java.sql.Timestamp;
    import java.util.Date;
    Date date = new Date();
    Timestamp ts = new Timestamp(date.getTime());Jesper

  • Import Design Object doesn't work

    Hi people.
    I have a PI 7.11 and I'm trying to import in quality environment a particular software component from development environment... and this operation seems doesn't work. The transport is via file.
    The SC was already existing and I'm trying to transport a simple mapping change.
    The import in QLT reports succesfully the same number objects exported in file but no change is visible in mapping in QLT.
    I tried to refresh all kind of cache in java and abap; restarted java stack but nothing change.
    Instead, the import of other SCs in QLT works fine.
    Some ideas to help me?
    Ciao.
    Nicola

    Hareenkumar,
    at the end I solved the problem thanks to yours suggestion.
    The problem was a mapping conflict in DEV environment for a map change made by another user.
    Unfortunately, it was been not enaugh to solve the conflict but I have had to delete entirely the SC before to be able to import the package.
    Thanks to RaviBabu too for his suggestions.
    Ciao. Nicola

  • 'select objects: click and drag to select several objects' doesn't work

    I have recently upgraded to Office 2010, and have the same problem as
    http://social.technet.microsoft.com/Forums/en-US/office2010/thread/75270638-e02b-4a78-b291-043abbca04ae?prof=required
    When I use Select - Select Objects in the Editing part of the ribbon to select multiple drawing shapes, it no longer works like in office 2007. I can't drag a rectangle in the document to select objects within an area.
    I would have guessed this is the same problem as the link I refer to, but I'm not running the beta version of 2010. It seems not to be solved.
    Anything I can do to fix this?

    I have just registered so I could reply to this thread.
    The registration process was very ... aehm ... frustrating, I was only able to fill in the correct Captcha after about 10 ties. But ... this is not unexpected, when working with a Microsfoft product. How am I supposed to know whether that bloody captcha
    wants me to to write '4Yp8' or '4yP8'. There is no way to tell. You can distinguish capital letters when it is something like A, a or H, h, but not between y and Y or P and p.
    I would like to thank all the posters for suggested workarounds. They work. Kinda - sorta ... . I was able to finish the editing of large picture (consisting of many graphics objects) that HAS to be made in word (My boss said so). All your tips saved
    me *hours* of frustration.
    I would like to tell Microsoft programmers AND their managers, that *if* the quote in the second post is correct: 
    ================
    The work needed to make the object selection work as it did in Word 2007 was out of scope for this release. It's not as
    simple as using the same feature that existed in the last version since we upgrading our graphics/art features; the way the shapes/objects need to be selected is different than how "old" graphics/art is selectable in Word 2007.
    That said, the "select object" tool that exists in Word 2010 should allow you to select individual shapes. You can select
    multiple shapes holding down the CTRL or SHIFT key while clicking shapes. You might ask how this is different than selecting shapes without turning on "select objects"; the answer to that would be to allow you to select shapes that are "behind" text, or more
    easily select rotated shapes, etc.
    ================
    You are bunch of incompetent amateurs. 
    If I used such lame excuse for missing important functionality at work, I would be very soon replaced by a more competent programmer.
    This time I am not a programmer, I am AN USER. And, as an user I do not care if your internal data structure for new objects doesn't let you do something easily. Find a way to implement that feature or change the data structure. Period.

  • Select object doesn't work

    Just bought Pro X and under Tools>Content all items are grayed out. The Select object button doesn't work. Any ideas?

    Good chance the PDF is secured. Try on another PDF that you make yourself just to be sure. You can also select the security properties of the PDF with ctrl-D. A last option my be that the PDF is archived (PDF/A) which does not allow many options such as editing..

  • Need to find the source code for java.util.LinkedList

    Hello all,
    I'm new to the forums and I actually need the LinkedList source file as well as all the source files for all Java packages and libraries. Please post a link here if you can, or email me at [email protected]
    Thanks again!
    copter_man

    But those must be platform dependant, not really that
    interesting to look at. I have never felt any need to
    look at those at least.Wake up and smell the coffee, abbie! I read the source code all the time and constantly tell my students to do that, too.
    1. Java source code is not platform dependent. The original poster wanted to look at linked list code, how could that be platform dependent?
    2. It is the implementation of the SDK APIs, so by definition it is implementation dependent code, liable to change in a later version. So don't assume anything beyond what is claimed in the API documentation. However, sometimes the documentation is incomplete or ambiguous to you, and reading the source can provide some insight, however implementation dependent. (Light a candle or curse the darkness.)
    3. Why read source code? It's a good way to learn how to program. You see something in the API and ask: how'd they do that? Or you realize you want to do something broadly similar, but you can't reuse the source code.
    For example, Images are not Serializable, but suppose you want a small image that is part of an object to be serialized with the rest of the object without too much fuss (ie, without using javax.imageio). You notice ImageIcon is serializable, so you use it. (An ImageIcon has-an Image.) Then you wonder: how'd they do that? You read the source and then you know.
    You live, you learn,
    Nax

  • Java 1.4.0_1 + Pentium4 + Widows doesn't work

    I have installed Windows2000 and Sun JavaPlugin for IE 1.4.0_1.
    Hardware: Motherboard ABIT BD7
    CPU P4
    RAM: 512 DDRAM 266
    Chipset: Intel 845
    Video: NVidia Riva TNT2 MX200
    Any java apps crashes in exception at startup. When I load applet from
    IE, java VM generates an exception and crashes IE to.
    Command line:
    java.exe -versionError occurred during initialization of VM
    java.lang.NullPointerException
    I repeate this situation on Windows2000/XP/98 (same hardware) and have a same
    results.

    Here's our solution (if one would call it that). We searched for SYMCJIT.DLL in the P4 machine and renamed it to SYMCJIT.DLL.OLD. I don't know if that was the real cause of the problem but there were issues noted in the past with that Oracle DLL and other versions of the JDK. Then, we attempted to install 1.4.1. It took forever, but we kept our eye on the processes and made sure we have nearly everything else shut down. It ate a ton of memory, then finished. After rebooting everything seems to work fine. We've tested compiling and running some simple java classes.

  • Adobe illustrator asks for Java SE 6 and the link doesn't work at Apple

    Adobe illustrator asks for Java SE 6 (a legacy installation) and won't run without it. The link to the legacy version at Apple goes to an error page ("too many redirects") Does anyone have a solution? Has something  changed recently. The mac help page is dated March 27, 2015, but the link at for Java SE 6 results in an error for me.

    Try this: Apple Java 2014-001.

  • Error in the Dates in java.util.Calendar/java.util.SimpleDateFormat

    I specifies the year(1999) and the week of that year(1).
    Then I want an existing date like 1999-01-01.
    But I get 1998-12-31. This date is WEEK 53 of year 1998.
    So what I found was that every week in a year (Ex. 1999),
    that have a previous year with 53 weeks (Ex. 1998), have
    their dates dislocated one week. This means that
    all dates I receive is from the previous week instead for
    the correct one.
    Code ex.
    Calendar aCalendar=Calendar.getInstance();
    aCalendar.set(Calendar.YEAR, aIntYear);
    aCalendar.set(Calendar.WEEK_OF_YEAR, aIntWeek);
    SimpleDateFormat aDateFormatter=new SimpleDateFormat ("yyyy-MM-dd");
    aDateFormatter.setCalendar(aCalendar);
    String aParsedDate=aDateFormatter.format(aCalendar.getTime());
    Have anyone a good solution for this, (without a check if the previous year
    has 53 weeks and then adding 1 to all weeks in the next year)?

    After reading the API I see that their implementation is correct. If the first day of the year doesn't begin on the first day of the week, then the first day of that week is in the previous year.
    For example if New Year's day is on Wednesday and the first day of that week is Sunday then the date of the first day of the week (Sunday) is in the previous year.
    I'm not sure how you would like to alter this, if you change it so that it ignores that the first week was not 7 days long then your program will return incorrect values. In the previous example, your proposed alteration would return January 5 as the first day of the first week of the year, which doesn't make any sense.
    One thing you could do is check to see that after you set the week, check to see whether the date returned is less than the first day of the year you set. If so return the first day of the year.

  • Java - sleep in a for loop doesn't work (as desired)

    Hey all,
    I'm trying to get a draw animation when the mouse is released (after dragging an object to a set area on the screen) - hence I'm trying to do this via a for loop with a small sleep() delay. However it isn't working. The delay is there, but nothing changes until the end of the for loop and then you only see the final repaint() [i.e. instead of each iteration in the for loop]:
    // This program is concerned with this and the mouseDragged methods
         public void mouseReleased(MouseEvent e)
              for( int c = 0; c < xButton.length; c++)
                   if( xButton[c] >= xRandWeight && xButton[c] <= (xRandWeight+50) && yButton[c] >= yRandWeight && yButton[c] <= (yRandWeight+50) )
                        // Have an animation for the scales re-adjusting
                        if( c == 0 )
                             currWeight = (int)(scales.getWeight2());
                             desiredWeight = Integer.parseInt(b1.getLabel());
                             if( desiredWeight >= currWeight )
                                  // More efficient than putting this subtraction straight into for loop
                                  difference = desiredWeight - currWeight;
                                  for( int count = 1 ; count <= difference ; count++ )
                                       scales.setWeight2(currWeight+count);
                                       repaint();
                                       try
                                            Thread.currentThread().sleep(100);
                                       catch (InterruptedException in)
                                            in.printStackTrace();
                             else
                                  difference = currWeight - desiredWeight;
                                  for( int count = 1 ; count <= difference ; count++ )
                                       scales.setWeight2(currWeight-count);
                                       repaint();
         }Any ideas on how to fix this/meet the goal would be greatly appreciated :)
    Thanks,
    Tristan Perry
    Edited by: TristanPerry on Nov 16, 2008 12:36 PM

    My program isn't being written in SWINGFirst, it's Swing, not SWING. It's not an acronym.
    Perhaps you would like to tell us which windowing toolkit you are using, so that you can get better responses. Or is that a closely guarded secret? <sarcasm/>
    I'm very new to JavaSo ditch the GUI stuff and get a foundation first.
    db

Maybe you are looking for

  • Multiple sites created in iWeb '08 / Personal Domains for Each?

    If I create more than one site in iWeb, can each site have its own Personal Domain? So far, I have created 2 sites: When I publish the first one, it shows up on the web as http://web.mac.com/myname/nameofmysite/etc (which is fine). But I would like f

  • Trouble with iPhone OS 3.1.2 Software Update

    I've tried to download and install this update at least a half dozen times in the past week. Each time the download fails and I get the error message that my network connection has timed out. There is no problem with my network connection, which work

  • How to put video on rome?

    I need help which video format it surpports. and music also?

  • How to disable a particular list item in flash cs3

    Friends, I need a small help on list component in flash cs3. assume that i have 5 items in my list and i want to disable 3,4,5 items from mylist box. how to do this ?? item 1 -- enabled state item 2 -- enabled state item 3 -- disabled state item 4 --

  • How to use sapmsg.ini file?

    Hi,      Whats the function of the sapmsg.ini file? How to use it?      And I searched my computer but didnt find it......