Class Data Sharing

I am trying to benchmark memory footprint using the class data sharing feature on Solaris8 and Solaris9.
I wrote a small sample java program MyApp.java as follows,
     import java.lang.*;
     public class MyApp {
          public static void main(String[] args) {
               System.out.println("Java VM Version Number = " + System.getProperty("java.vm.version"));
               long maxMem = Runtime.getRuntime().totalMemory();
               System.out.println("Total Memory in bytes= " + maxMem);
               long freeMem = Runtime.getRuntime().freeMemory();
               System.out.println("Free Memory in bytes= " + freeMem);
               long memUsed = maxMem - freeMem;
               System.out.println("Memory Used in bytes= " + memUsed);
               long t1 = System.currentTimeMillis();
               for (int i = 0; i < 3; i++)
                    try
                         System.out.println("iteration count = " + i+1);
                         Thread.sleep(1000 * 60);
                         long t2 = System.currentTimeMillis();
                         long t3 = t2 - t1;
                         System.out.println("time elapsed in milliseconds = " + t3);
                    catch (InterruptedException e)
     $JAVA_HOME = /packages/sun/j2sdk1.5.0_02/jdk1.5.0_02/
     I ran it both the machines with the following options
     1)     $JAVA_HOME/bin/java �client �Xshare:on MyApp
     2)     $JAVA_HOME/bin/java �client �Xshare:off MyApp
     I ran the pmap command with �x option to get the readings
     A) Solari8:
          VM Option     RSS          Shared Mem          Private Mem
          Xshare:on     53584KB     50600KB          2984KB
          XShare:off     11456KB     7808KB          3648KB
          JDK1.4     29736KB     26392KB          3344KB
     B) Solaris9:
          VM Option      RSS          Anonymous mem
          Xshare:on     49384KB     3048KB
          Xshare:off     48576KB     3704KB
          JDK1.4     33656KB     2856KB
     These numbers repeat for multiple instances of the same application.
     I do not see the expected memory savings.
     I am trying to find out if I am missing any step in the process of using
     Class Data Sharing feature of JDK1.5
Thanks!!

Samantha10 wrote:
Is this class data sharing possible for user defined classes also? i have a singleton class which i am invoking through a script. The script has been scheduled to run every 1 sec . Since it is being invoked every 1 sec hence the singleton pattern is failing . Hence if the this class data sharing is possible then the singleton pattern can be made applicable.If you have a single process and you have a single class loaded by two different ClassLoader instances
in some respects they will be two different classes
if (class1 instanceof class2.getClass())returns false.
This is not the case for Java core classes because they are always loaded by the SystemClassLoader.
You write you
have a singleton class which i am invoking through a script. What approach to you use to invoke the singleton?
I am trying to figure out if you launch a new JVM every second...
Maybe you can use Nailgun.

Similar Messages

  • Class Data Sharing for User Defined Classes

    i am using jdk 5.0 . JDK 5.0 supports class data sharing for system level classes. Is there any way a class data sharing be done for a user defined class?

    Samantha10 wrote:
    Is this class data sharing possible for user defined classes also? i have a singleton class which i am invoking through a script. The script has been scheduled to run every 1 sec . Since it is being invoked every 1 sec hence the singleton pattern is failing . Hence if the this class data sharing is possible then the singleton pattern can be made applicable.If you have a single process and you have a single class loaded by two different ClassLoader instances
    in some respects they will be two different classes
    if (class1 instanceof class2.getClass())returns false.
    This is not the case for Java core classes because they are always loaded by the SystemClassLoader.
    You write you
    have a singleton class which i am invoking through a script. What approach to you use to invoke the singleton?
    I am trying to figure out if you launch a new JVM every second...
    Maybe you can use Nailgun.

  • Javaagent and class data sharing with Java 6.0

    Hi,
    I'm trying to use instrumentation (using the -javaagent) but
    I noticed that when I run the my application with JDK 1.6 it loads all system
    classes from the "shared objects file" and the transformer has no chance to run.
    With JDK 1.5 it works fine, as well as in debug mode of JDK 1.6.
    Is this normal or it is a bug? If it is normal, how should I instrument the system classes?
    Thanks in advance,
    Genady

    I just found that the reason it was working for me with JDK 1.5 is that my classes.jsa file was corrupted for some reason.
    So the behavior is consistent for both JDK 1.5 and 1.6.
    I also found that if I add
    Can-Redefine-Classes: true to the manifest (even if I don't do any class redefinitions) it causes the class data sharing to be disabled.
    This workaround is good enough for me.
    Genady

  • Class Data Sharing : what the definition of JSA ?

    Hi everybody,
    I read the article on Class Data Sharing (http://java.sun.com/j2se/1.5.0/docs/guide/vm/class-data-sharing.html) and they speak about the file classes.jsa
    I'm curious and I would like to know the definition of JSA extension.
    Maybe JavaSharedArchive ?
    google say me that JavaSharedArchive is used by Mac but not by JRE1.5 !
    Thanks for your explications !
    Obelix

    Since the point of using a hotspot is to provide data to other devices, the answer to your question is YES.

  • Class Data Sharing in Java 5

    Hi All,
    I am looking at porting over our current Java application from Java 1.4.2 to Java 1.5.
    One of the main reasons is because of the CDS facility in Java 1.5.
    Running the same app, one on 1.4.2 and the other on 1.5, on 1.5 it uses about 20% more memory !!!!
    This application involves 3 JVM's running communicating via RMI.
    When I start each of the applications with -Xshare:on, the first starts fine, indicating it is using CDS,
    (-showversion parameter will indicate sharing), but then the next two wont start giving an error indicating
    the shared archive cannot be accessed.
    Before I started the apps I manually created the shared archive using the call java -Xshare:dump which
    places the classes.jsa file in the directory jre/lib/i386/client/classes.jsa
    I am running an Intel Solaris platform.
    Any ideas why this isnt working ?

    ok, I have some more information after doing more investigation...
    Here is the bug which I submitted to Sun...
    FULL OS VERSION :
    SunOS con1 5.8 Generic_108529-29 i86pc i386 i86pc
    A DESCRIPTION OF THE PROBLEM :
    I am running an application with 3 JVM's. I have manually enabled Class Data Sharing using the command java -Xshare:dump. This seems to work fine.
    When I start the first JVM with the command line option -Xshare:on it seems to start fine and indicates "sharing" when I print out -showversion.
    Then when I start any subsequent JVM's with -Xshare:on AND the -Xmx5m parameter I receive the following error:
    An error has occured while processing the shared archive file. Unable to reserve shared region. Error occurred during initialization of VM Unable to use shared archive.
    It seems to work fine if I dont set the maximum heap size.
    THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
    THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: No
    STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
    Try to execute a JVM with class data sharing on, then try it again with class data sharing on, AND trying to set the maximum heap size.
    EXPECTED VERSUS ACTUAL BEHAVIOR :
    It should still allow CDS.
    ERROR MESSAGES/STACK TRACES THAT OCCUR :
    An error has occured while processing the shared archive file. Unable to reserve shared region. Error occurred during initialization of VM Unable to use shared archive.
    REPRODUCIBILITY :
    This bug can be reproduced always.
    The error only occurs when using Xshare AND Xms<NUMBER>m as parameters !

  • Class Data Sharing (CDS) and memory analys with pmap

    Hi everybody,
    I read that CDS can decrease the memory footprint by sharing some librairies.
    I did some tests on PowerPC board and embeddedJVM 1.5 with 128Mo ROM
    I wrote a HelloWorld with a sleep(10) and see the results :
    # java -Xshare:off HelloWorld
    mapped:   172568 KB writable/private: 165708 KB shared: 32 KB
    # java -Xshare:on HelloWorld
    mapped:   201112 KB writable/private: 188604 KB shared: 5680 KBThe shared memory increase, normal...
    The memory mapped and writable/private increase, I thought that memory will decrease...
    so, where is the benefits ?
    And the mapped memory is > to board memory ! why ?
    thanks for your help
    Obelix

    somebody can do this tests please :
    Write a HelloWord.java with a sleep() of 10s and execute this scripts :
    #!/bin/sh
    java -version >> testsCDSoff.txt 2>&1
    java -Xshare:off HelloWorld &
    PID=$!
    sleep 2
    pmap -d $PID | grep mapped >> testsCDSoff.txt
    java -Xshare:off HelloWorld &
    PID=$!
    sleep 2
    pmap -d $PID | grep mapped >> testsCDSoff.txt
    java -Xshare:off HelloWorld &
    PID=$!
    sleep 2
    pmap -d $PID | grep mapped >> testsCDSoff.txtand
    #!/bin/sh
    java -version >> testsCDSon.txt 2>&1
    java -Xshare:on HelloWorld &
    PID=$!
    sleep 2
    pmap -d $PID | grep mapped >> testsCDSon.txt
    java -Xshare:on HelloWorld &
    PID=$!
    sleep 2
    pmap -d $PID | grep mapped >> testsCDSon.txt
    java -Xshare:on HelloWorld &
    PID=$!
    sleep 2
    pmap -d $PID | grep mapped >> testsCDSon.txtand then dump testsCDSoff.txt and testsCDSon.txt here :D
    Look at mines :
    testsCDSoff.txt
    java version "1.5.0_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
    Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
    mapped: 237220K    writeable/private: 186972K    shared: 44740K
    mapped: 237220K    writeable/private: 186972K    shared: 44740K
    mapped: 237220K    writeable/private: 186972K    shared: 44740K
    testsCDSon.txt
    java version "1.5.0_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
    Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
    mapped: 265808K    writeable/private: 210252K    shared: 50048K
    mapped: 265808K    writeable/private: 210252K    shared: 50048K
    mapped: 265808K    writeable/private: 210252K    shared: 50048Kwhere is the benefits ? I did an error somewhere or I don't understand CDS ?

  • Class-data versus data and methods versus class-methods in OO ABAP

    Hi
    I was going thorugh following OO ABAP code.
    CLASS vessel DEFINITION.
      PUBLIC SECTION.
        METHODS: constructor,
                 drive IMPORTING speed_up TYPE i,
                 get_id RETURNING value(id) TYPE i.
        CLASS-METHODS: start,
                       objects,
                       inheritance,
                       interfaces,
                       events.
      PROTECTED SECTION.
        DATA: speed TYPE i,
              max_speed TYPE i VALUE 100.
      PRIVATE SECTION.
        CLASS-DATA object_count TYPE i.
        DATA id TYPE i.
    ENDCLASS.
    Whats is difference between methods and class-methods ?
    What is the difference between data and class-data ?

    Hi Rajesh,
    There are two types of componenets in a class
    1)Static components
    2) Instance components
    Instance components exist for every instance of the class, while static exist only once for any number of instances of the class.
    Components of the class are methods, attributes, events etc.
    static attributes are represented by CLASS-DATA and instance attributes are represented by DATA.
    static methods hence are done by CLASS-METHODS and can access only static attributes.
    Instance methods are done by METHODS and can access any attribute.
    For eg: supposing that in a class, there is a static attribute. Suppose after one instance is created, we are setting this static attribute value as 10. Now we are creating another instance of the same class. Now when you try to display the value of this attribute, it will be 10.ie. it needs to be initialized once and can be shared between instances.
    Just go through this document..You will get nice info from this.
    http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    If you want to go deeper, like object persistence and all, just refer this document.
    http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    Regards,
    SP.

  • CLASS-DATA in OO ABAP

    Hi,
    I know the definition of CLASS-DATA in OO concept. I understand that it can be accessed by on CLASS-METHODS.
    But what is the use of it ? Why do we need static data ?
    Is this different fro STATICS we use in procedural ABAP.
    Regards,
    Rajesh.

    If there are multiple instances of the class, the data area is shared between all instances, which means when instance 1 of the class sets the value, then all other instances have the attribute with the same value,  I believe that  iit points to the same memory.  Here is an example app, notice that then the first object is created, it sets the value,  then when writing out the objects,  both instances see the same value for NUM1 even though only the first object actually filled the value,  so the second is looking at the same memory area because it is labeled as CLASS-DATA.
    report zrich_0001.
    *       CLASS lcl_tst DEFINITION
    class lcl_tst definition.
      public section.
        class-data: num1 type n.
        data: num2 type n,
              num3 type n.
        methods: constructor importing im_num1 type n
                                       im_num2 type n
                                       im_num3 type n.
    endclass.
    *       CLASS lcl_tst IMPLEMENTATION
    class lcl_tst implementation.
      method constructor.
        if not im_num1 is initial.
          num1 = im_num1.
        endif.
        if not im_num2 is initial.
          num2 = im_num2.
        endif.
        if not im_num3 is initial.
          num3 = im_num3.
        endif.
      endmethod.
    endclass.
    data: o_tst type ref to lcl_tst.
    data: o_tst_list type table of ref to lcl_tst.
    data: no_value type n.
    start-of-selection.
      create object o_tst
            exporting
                 im_num1 = '3'
                 im_num2 = '4'
                 im_num3 = '5'.
      append o_tst to o_tst_list.
      create object o_tst
         exporting
              im_num1 = no_value
              im_num2 = '6'
              im_num3 = '7'.
      append o_tst to o_tst_list.
      loop at o_tst_list into o_tst.
        write:/ o_tst->num1, o_tst->num2, o_tst->num3.
      endloop.
    Regards,
    Rich Heilman

  • About Thread resource (data) sharing

    I am new to java. In my project, there is scenario where one thread (Main Thread) creates a resource (data) and create new thread and then that resource (data) needs to be access by thread which is running on same application which is created by Main Thread.How can access a thread resource (data) which is created Main Thread from another thread which also created Main Thread in java?
    Thanks,
    Sidiq

    You could pass it as a parameter to the constructor to your class that implements Runnable (do not extend Thread). Or you could make it available via some globally accessible variable--e.g. a public static member of some class. Or, I think there are tools in java.util.concurrent that you could use for inter-thread data sharing, depending on how things change as you two threads do their work.
    You haven't provided enough detail for a more specific answer than that.

  • ITunes 10.5.3, Unable to Load Class Data from Sync Services, Crashes Repeatedly

    Ever since iTunes 10.5.3 on my Windows 7 x64 box, I've been having serious problems keeping iTunes running:
    1)  Any time I connect my iPhone or iPad, or any time they attempt to sync over WiFi, I get the 'Unable to load class data from sync services' error.  It's worth mention that the iPhone or iPad do actually then proceed to sync correctly, and all media / data is synchronized successfully, as far as I've been able to tell.  I've reset sync history, restored the iPhone and iPad, manually moved the SyncServices directory, set both the iPhone and iPad up as new, completely uninstalled iTunes and the mobile device software, re-installed, and *nothing* I do fixes this issue or even seems to impact it.  Uninstalling iTunes 10.5.3 and reinstalling iTunes 10.5.2 resolves this error.
    2)  iTunes 10.5.3 has serious crashing problems on my machine, though I've searched through forums and found a lot of other people with the problem.  In my case, sporadically as iTunes access the iTunes store (for example, I can always make it happen by subscribing to the Diggnation podcast and telling it to refresh the podcast), I get a full application crash which generates the following event in the event log:
    Faulting application name: iTunes.exe, version: 10.5.3.3, time stamp: 0x4f14cc3d
    Faulting module name: KERNELBASE.dll, version: 6.1.7601.17651, time stamp: 0x4e211319
    Exception code: 0x80000003
    Fault offset: 0x0001280c
    Faulting process id: 0x564
    Faulting application start time: 0x01cce78789dc009a
    Faulting application path: D:\Program Files (x86)\iTunes\iTunes.exe
    Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
    Report Id: ecc77400-537a-11e1-b809-00248c196007
    Again, uninstalling iTunes 10.5.3 and re-installing iTunes 10.5.2 fixes this issue as well, but I really shouldn't have to do that.  Is there any actual solution to these problems other than dowgrading to an older version?
    Yes, I'm running current malware protection (and my system is clean) and yes, I've already checked any other obvious culprits to make sure I don't just have a corrupt library or file somewhere that's causing it.  My Windows 7 install is completely up to date from a Windows Update perspective and also from a driver perspective (even including the motherboard and chipset drivers).  I made sure to do a system file integrity check (sfc /scannow) and it confirmed my install of Windows isn't suspect, but beyond all that I was able to reproduce these failures on a completely separate machine running Windows 7 x64, without any of my media library or data on it -- iTunes 10.5.3 just seems to be bad news on Windows 7 x64 for me, even though I know there are definitely people are using it successfully.  I don't get any other application crashes for any other applications, and I've never had an issue like this with any previous version of iTunes...
    Last but not least, in case it matters, I'm running iOS 5.0.1 on both the iPhone4 and the iPad2.  The iPhone4 is the GSM AT&T model and the iPad2 is the CDMA Verizon model.

    OK, I've given up.  Uninstalled iTunes 10.5.3 permanently.  It's a shame, 10.5.2 works perfectly but 10.5.3 is a complete and total cluster for me.
    Anyone with the same problems who hasn't done this already, just uninstall iTunes and the Apple Mobile Device Service in your Add/Remove Programs, then re-install iTunes 10.5.2.  You won't lose your library or any settings or apps, it will just go back to working again.
    I wish Apple would acknowledge this so that I'd at least know it would be fixed in the future.

  • "iTunes was unable to load class data information from sync services"

    I own iTunes 10.5 beta 3 64-bit for my 64-bit windows 7 pc, and it gives me this message whenever I try to sync ANY of my devices: "iTunes was unable to load class data information from Sync Services". I own an old iPod video and an iPhone 4 with iOS 5 beta 3. I've tried uninstalling all Apple products, searching through my hard drive and deleting everything Apple, cleaning the registry, EVERYTHING. I've reinstalled at least 4 times now. The problem refuses to become fixed. I've searched every article online possible, and none of the solutions have worked. Is there anything I can do to get my stuff back on to my devices???

    In the course of your troubleshooting to date, have you worked through the following document?
    iTunes for Windows: "Unable to load data class" or "Unable to load provider data" sync services alert

  • Class data upload through LSMW using BAPI

    Hi All,
    Plz tell me how to upload class data through LSMW using BAPI.I also need some study material on BAPI.
    Bye,
    Mithilesh Tiwari

    its not possible with single file
    for this you need to pass two files of data
    1 ) Header data ZSOURCE_LIST_HEADER       Source List Header
         MATNR                          C(018)    Material Number
                                        Selection Parameter for "Import/
         WERKS                          C(004)    Plant
    2) item data     ZSOURCE_LIST_ITEM         Source List Item
             MATNR                          C(018)    Material Number
             LIFNR                          C(010)    Vendor Number
             EKORG                          C(004)    Purchasing Organiz
             WERKS                          C(004)    Plant
             VDATU                          C(008)    Valid From
             BDATU                          C(008)    Valid to
    for this use below LSMW IDOC method
    Message Type         SRCLST                      Source List
    Basic Type           SRCLST01                    Source List

  • Cannot reslove symbol class Date

    I am trying to get a clock to show the time in my program. However, when I try to compile the program a "cannot resolve symbol class Date" error appears. I can't figure out where the problem in my program is. Here is my source code. I would appreciate any help.
    import javax.swing.*;
    import java.io.*;
    import java.lang.*;
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    //import java.util.*;
    import java.math.*;
    public class store
    public static void main(String[] args)
    String dataInput;
         dataInput = JOptionPane.showInputDialog(null, "Input item data: ");
    JOptionPane.showMessageDialog(null, "" + dataInput);
    EasyReader console = new EasyReader();
    int i, j, k, inum, icom, min, nswaps; inum = 0; boolean swap = false;
    double num[] = new double[100]; double dsum, T;
         do
         System.out.println(); System.out.println("Command Menu"); System.out.println();
         System.out.println("1 = Display the data");
    System.out.println("2 = Bubble Sort the numbers");
    System.out.println("3 = Selection Sort the numbers");
    System.out.println("4 = Insertion Sort the numbers");
    System.out.println("5 = Binary Search for a number");
    System.out.println("0 = Exit the program"); System.out.println();
    System.out.print("Enter Command - ");
    icom = console.readInt(); System.out.println();
    switch (icom)
    case 1: // Display the data
                   Display(inum, num);
                   break;
    case 2: // Bubble sort
                   nswaps = 0;
                   for (i = 0; i < (inum-1); i++ )
              for (j = (i+1); j < inum; j++)
                        if (num[i] > num[j])
                                  T = num;
                             num[i] = num[j];
                             num[j] = T;
                             nswaps++;
                   System.out.println("The number of swaps was - " + nswaps);
                   Display(inum, num);
                   break;
    case 3: // Selection sort
                   nswaps = 0;
                   for (i = 0; i < inum - 1; i++) {
              min = i; swap = false;
    for (j = i + 1; j < inum; j++)
         if (num[j] < num[min]) { min = j; swap = true; }
    if (swap) {T = num[min];
              num[min] = num[i];
                        num[i] = T;
                        nswaps++;}
                   System.out.println("The number of swaps was - " + nswaps);
                   Display(inum, num);
                   break;          
    case 4: // Selection sort
                   nswaps = 0;
                   for (i = 1; i < inum; i++)
                   j = i; T = num[i];
                        while ((j > 0) && (T < num[j-1]))
              num[j] = num[j-1]; j--; nswaps++;
                   num[j] = T; nswaps++;
                   System.out.println("The number of swaps was - " + nswaps);
                   Display(inum, num);
                   break;
    case 5: // Binary Search
                   System.out.println("Your numbers will be sorted first");
                   System.out.println();
                   for (i = 1; i < inum; i++)
                   j = i; T = num[i];
                        while ((j > 0) && (T < num[j-1]))
              num[j] = num[j-1]; j--;
                   num[j] = T;
                   System.out.print("Enter the number to locate - ");
                   T = console.readDouble(); nswaps = 0; System.out.println();
                   int left = 0, right = inum, middle; k = -1;
                   while (left <= right)
                        middle = (left + right) / 2;
                        if (T > num[middle]) {left = middle + 1; nswaps++;}
                        else if (T < num[middle]) {right = middle - 1; nswaps++;}
                        else { k = middle; break; }
                   if (k == -1) System.out.println("Your number was not located in the array");
                   else System.out.println("Your number " + T + " is in position " + (k+1));
                   System.out.println();
                   System.out.println(nswaps + " comparisons were needed to search for your number");     
                   Display(inum, num);
                   break;
         } while (icom != 0);
         public static void Display(int inum, double num[])
              {     int k;
                   System.out.println();
                   System.out.println("");
                   System.out.println();
              for (k = 0; k < inum; k++)
              System.out.println((k+1) + " - " + num[k]);
         return;
    class Clock extends Thread
         //A Canvas that will display the current time on the calculator
         Canvas Time;
         //A Date object that will access the current time
         private Date now;
         //A string to hold the current time
         private String currentTime;
         //The constructor for Clock, accepting a Label as an argument
         public Clock(Canvas _Time)
              Time = Time;          //Time is passed by reference, so Time
                                       //now refers to the same Canvas
              start();               //start this thread
         //The overriden run method of this thread
         public void run()
              //while this thread exists
              while (true)
                   try
                        draw_clock();          //calls the draw_clock method
                        sleep(1000);          //puts this thread to sleep for one
                                                 //second
                   //catches an InterruptedException that the sleep() method might throw
                   catch (InterruptedException e) { suspend(); }
                   //catches a NullPointerException and suspends the thread if one occurs
                   catch (NullPointerException e) { suspend(); }
         //A method to draw the current time onto the Time Canvas on the applet
         public void draw_clock()
              try
                   //Obtains the Graphics object from the Canvas Time so that it can
                   //be manipulated directly
                   Graphics g = Time.getGraphics();
                   g.setColor(Color.gray);          //sets the color of the Graphics object
                                                      //to gray for the rectangle background
                   g.fillRect(0,0,165,25);          //fills the Canvas area with a rectangle
                                                      //starting at 0,0 coordinates of the Canvas
                                                      //and extending to the length and width
                   g.setColor(Color.orange);     //sets the color of the Graphics object
                                                      //to orange for the text color
                   get_the_time();                    //calls the get_the_time() method
                   //calls the drawString method of the Graphics object g, which will
                   //draw a string to the screen
                   //Accepts a string and two integers to represent the coordinates
                   g.drawString("Current Time - " + currentTime, 0, 17);          
              //catches a NullPointerException and suspends the thread if one occurs
              catch (NullPointerException e) { suspend(); }
         //A method to obtain the current time, accurate to the second
         public void get_the_time()
              //creates a new Date object for "now" every time this is called
              now = new Date( );
              //integers to hold the hours, minutes and seconds of the current time
              int a = now.getHours();
              int b = now.getMinutes();
              int c = now.getSeconds();
              if (a == 0) a = 12;          //if hours are zero, set them to twelve
              if (a > 12) a = a -12;     //if hours are greater than twelve, make a      
                                            //conversion to civilian time, as opposed to
                                            //24-hour time
              if ( a < 10)               //if hours are less than 10
                   //sets the currentTime string to 0, appends a's value and a
                   //colon
                   currentTime = "0" + a + ":" ;
              else
                   //otherwise set currentTime string to "a", append a colon
                   currentTime = a +":";               
              if (b < 10)                    //if minutes are less than ten
                   //append a zero to string currentTime, then append "b" and a colon
                   currentTime = currentTime + "0" + b + ":" ;
              else
                   //otherwise append "b" and a colon to currentTime string
                   currentTime = currentTime + b + ":" ;
              if (c < 10)                    //if seconds are less than ten
                   //append a zero to string currentTime, then append "c" and a colon
                   currentTime = currentTime + "0" + c ;
              else     
                   //otherwise append "c" to currentTime string
                   currentTime = currentTime + c;
    }          //end of the Clock class

    Wow.
    1) Please in future use the code tags to format code you post so that it doesn't think you have italics in your code and render it largely1 unreadable. Read this
    http://forum.java.sun.com/help.jspa?sec=formatting
    2) You commented out the import of java.util which is the problem you are complaining about.
    3) Are you planning to stick all the code you ever write into the one source file? Why is all this stuff rammed together. Yoinks.

  • How to upload mass characteristic & class data.

    Hi Team,
    How to upload mass characteristic & class data. Is any BAPI or program available for this. LSMW is not working for this upload. Pls suggest.
    Thanks

    Hi,
    Following are BAPI available-
    1) BAPI_CLASS_CREATE Create Class BAPI
    2) BAPI_CHARACT_CREATE BAPI for Characteristics u2013 Create
    For more BAPI List go to link [http://www.sapbapi.com/bapi-list/|BAPI LIST]  
    You can use Ecatt for upload mass characteristic & class data. For Ecatt you go through this link  [http://www.****************/Tutorials/eCATT/SAPGUIRecording/demo.htm|Ecatt Link]
    Regards,
    Ashish
    Edited by: A. A. Vaidya on Aug 14, 2009 9:20 AM

  • Bug?: Using waveform prims to unbundle class data

    I discovered this the other day and figure it's not something that NI intentionally permits.  Feel free to correct me if this is expected behavior.
    Attaching a class wire to a Get Waveform Components prim allows you to unbundle the class data.  This works on IPE waveform border nodes too.
    (Cross posted to Lava.)

    I discovered this the other day and figure it's not something that NI intentionally permits.  Feel free to correct me if this is expected behavior.
    Attaching a class wire to a Get Waveform Components prim allows you to unbundle the class data.  This works on IPE waveform border nodes too.
    (Cross posted to Lava.)

Maybe you are looking for

  • How Can you get your hot mail.

    How can I use mail on my Mac to get my hot mail like i did with outlook on my PC.? Mac Minni   Mac OS X (10.4.7)  

  • HELP ipod not recognised on PC

    Help My Ipod does not show up on my PC. It does not dingdong when you plug it in. I have tried another ipod I have got ang that still picks up on the PC. I have tried restoring the Ipod, I have reinstalled Itunes, and I have checked the drivers on th

  • Memory-Leak in communication of Acrobat-Flash and JS

    Hi The situation is as follows: I have a Flash-SWF (in which I have programmed a GUI) I have a 3D-Annotation containing an annotation-script with some functions that can be called from the GUI. So far so good. The SWF is added as overlay to a 3D-Anno

  • Two dynamic ALV grid

    Hi experts,   I am having a dynamic ALV grid. How to create a new grid(second grid) in the same page with different values? Thanks&Regards, vino

  • Youtube will not load in Safari - help please

    I can get to the Youtube site with no problem, but no videos will download/play. Instead, the screen sticks on "loading" and the spinning ball. Firefox works fine. For Safari 5.0.3 I have tried suggestions from this forum to include deleting Youtube