Time constrain in Core Java...not using Threads

Hi All,
I m designing a very small practice application in Java. I am running the program thru command prompt. Once the program starts, I want user t respond in certain amount of time, lets say 3 seconds.
I tried looking for some "TIMER" classes in java api docs.
most classes are used with Thread or MBean. I dont want to implement it this way.
Could anyone pls help me identify how can this be implemented in core java without any fency classes like Thread being used.
Looking forward for response.

shilpadahiya wrote:
Hi All,
I m designing a very small practice application in Java. I am running the program thru command prompt. Once the program starts, I want user t respond in certain amount of time, lets say 3 seconds. You need to be clearer. When the three seconds are over do you want the program to output "times up!" and proceed, or do you want the program to wait for as long as it takes the user to answer and only after they answer the program responds, "you took 7.9 seconds!"
I tried looking for some "TIMER" classes in java api docs.
most classes are used with Thread or MBean. I dont want to implement it this way.Why not?

Similar Messages

  • Time Machine Error Prevention - Do Not Use "/" Symbols on the names on HD!

    This is a warning message:
    If your Time Machine Backup Fails with the Message:
    "The Backup Was Not Performed Because an Error Occurred while Copying Files To the Backup Disk. The problem May be temporary. Try again later to back up.etc.."
    *If you Use Symbols In Your Names DONT!*
    *Do Not Use this / slash Symbol on the names of your Hard Drives*! Also check your logs to see if the TM backup is hanging on a file name with : or / symbol.
    *Back Story*
    I had purchased a new 3TB Western Digital HD and needed to do a full backup. I never had issues with Time Machine before. But After trying 2 times and received the error message I new something was wrong.
    I did some research installed the Time Machine Widget and checked Console for the error codes.
    I was searching on the forums here and just read a post from Pandini regarding the use of characters in file names. I was having an issue with an error code #2 every time. I reformatted with a GUID Partition (Intel Only) and verified and repaired the disks and permissions on everything was good on all my HD's.
    After reading his short post about the characters possibly causing the issue I changed the naming on one of the external USB drives to be backed up.
    I had it labeled as "Audio/Video/Docs 1TB."
    I changed to: "Audio Video Docs 1TB" then tried the backup again it worked great.
    It's amazing how a / slash can hang then entire system. I wish Apple would provide some informational notes about these very very simple subtle issues.
    Thanks to Pandini for the post, it was the key clue. Save yourself some time and check your logs and hard drive naming to be sure there are no / Slashes.
    Thanks to everyone on the forum for their contributions.

    Problem solved. Issue resolved. Problem was due to the : or / symbol in the file or HD name.

  • Java Program Using Threads

    Hi there, im really new and have just started programming in Java, i have to create a java program which implement threads. Thread.Wait, thread.start them etc.
    Here is the problem, any guidance would be great cheers guys
    The manager of a company employs 3 secretaries who are of varying ability, but who all work extremely fast. Secretary A is the most experienced secretary and is capable of typing up a letter once every second. Secretary B is less experienced and is capable of typing up a letter once every 2 seconds. Secretary C is the junior secretary and is capable of typing up a letter once every 4 seconds. When a secretary has typed up a letter he leaves it in the manager?s tray for him to remove and sign. The manager removes and signs a letter from the tray once every 2 seconds. The tray can hold a maximum of 5 letters at a time. The tray?s limited capacity sometimes causes the various workers to be delayed. For example, if the tray is full after a letter has been typed, the secretaries must wait until the manager makes a space available before they can add another letter to the tray. Similarly, the manager must wait for at least one letter to appear in the tray before he can take it out and sign it.
    In your program, make use of threads to represent each of the workers (the 3 secretaries and the manager), so that they can work in parallel. You will also need to declare a tray object, and ensure that all communication is properly synchronised to avoid indeterminacy and deadlock. While an office worker is busy typing a letter or signing it, you should send that thread to sleep for the appropriate time period. This can be achieved with a call to:
    Thread.sleep(m);
    where m is the number of milliseconds for which the thread should suspend.
    The output from your program should take the form of a running commentary on the activity taking place in the office. An extract from it might look something like this (though it is up to you how you word this):
    Secretary A is ready to type a letter
    Secretary A has typed a letter, number now typed = 6
    Tray full. Secretary must wait until a letter has been removed before adding another
    Secretary C has typed a letter, number now typed = 2
    Tray full. Secretary must wait until a letter has been removed before adding another
    A letter has been removed from the tray. Tray = 4
    The Manager has taken a letter from the tray to sign, number signed = 4
    The Manager is ready to sign a letter
         etc
    Run your simulation until the secretaries have typed and filed 7 letters each, and the manager has removed and signed all 21 letters.
    Thanks again

    Then you're probably better off enlisting one-on-one, in-person help from your instructor, a classmate, or a private tutor, or joining a study group. Forums like this are not well-suited to tutoring you from the ground up.
    If you're doing multithreaded homework and you don't even know where to start, it sounds like ether the instructor is horrible or you're in over your head, or you just haven't been keeping up with the class.
    Good luck.

  • Time Machine & external hard drives not used daily

    I have a question about Time Machine and external hard drives that I used for storing digital files. I do not need to turn on these drives every day. Or even every week. Is Time Machine going to "forget" them (delete their files from backups) if I don't turn them on regularly? What do I do to make sure they are safely backed up and that they stay backed up even if they aren't turned on every day?

    As I said, then, "Time Machine will simply pick up wherever it left off." Just be sure to properly eject the drive before disconnecting or shutting off.
    The "speed" question is a new one not present in your original post. You can address that in the following:
    Kappy's Personal Suggestions About Mac Maintenance
    For disk repairs use Disk Utility.  For situations DU cannot handle the best third-party utility is: Disk Warrior;  DW only fixes problems with the disk directory, but most disk problems are caused by directory corruption. Drive Genius provides additional tools not found in Disk Warrior for defragmentation of older drives, disk repair, disk scans, formatting, partitioning, disk copy, and benchmarking. 
    Four outstanding sources of information on Mac maintenance are:
    1. OS X Maintenance - MacAttorney.
    2. Mac maintenance Quick Assist
    3. Maintaining Mac OS X
    4. Mac Maintenance Guide
    Periodic Maintenance
    OS X performs certain maintenance functions that are scheduled to occur on a daily, weekly, or monthly period. The maintenance scripts run in the early AM only if the computer is turned on 24/7 (no sleep.) See Mac OS X- About background maintenance tasks. If you are running Leopard or later these tasks are run automatically, so there is no need to use any third-party software to force running these tasks.
    If you are using a pre-Leopard version of OS X, then an excellent solution is to download and install a shareware utility such as Macaroni, JAW PseudoAnacron, or Anacron that will automate the maintenance activity regardless of whether the computer is turned off or asleep.  Dependence upon third-party utilities to run the periodic maintenance scripts was significantly reduced after Tiger.  (These utilities have limited or no functionality with Snow Leopard, Lion, or Mountain Lion and should not be installed.)
    Defragmentation
    OS X automatically defragments files less than 20 MBs in size, so unless you have a disk full of very large files there's little need for defragmenting the hard drive except when trying to install Boot Camp on a fragmented drive. But you don't need to buy third-party software. All you need is a spare external hard drive and Carbon Copy Cloner.
    Cheap and Easy Defragmentation
    You will have to backup your OS X partition to an external drive, boot from the external drive, use Disk Utility to repartition and reformat your hard drive back to a single volume, then restore your backup to the internal hard drive. You will use Carbon Copy Cloner to create the backup and to restore it.
      1. Get an empty external hard drive and clone your internal drive to the
           external one.
      2. Boot from the external hard drive.
      3. Erase the internal hard drive.
      4. Restore the external clone to the internal hard drive.
    Clone the internal drive to the external drive
      1. Open Carbon Copy Cloner.
      2. Select the Source volume from the left side dropdown menu.
      3. Select the Destination volume from the left side dropdown menu.
      4. Be sure the Block Copy button is not depressed or is ghosted.
      5. Click on the Clone button.
    Destination means the external backup drive. Source means the internal startup drive.
    Restart the computer and after the chime press and hold down the OPTION key until the boot manager appears.  Select the icon for the external drive and click on the upward pointing arrow button.
    After startup do the following:
    Erase internal hard drive
      1. Open Disk Utility in your Utilities folder.
      2. After DU loads select your internal hard drive (this is the entry with the
           mfgr.'s ID and size) from the left side list. Note the SMART status of the
           drive in DU's status area.  If it does not say "Verified" then the drive is
           failing or has failed and will need replacing.  SMART info will not be
           reported  on external drives. Otherwise, click on the Partition tab in the
           DU main window.
      3. Under the Volume Scheme heading set the number of partitions from the
           drop down menu to one. Set the format type to Mac OS Extended
           (Journaled.) Click on the Options button, set the partition scheme to
           GUID then click on the OK button. Click on the Partition button and wait
           until the process has completed.
    Restore the clone to the internal hard drive
      1. Open Carbon Copy Cloner.
      2. Select the Source volume from the left side dropdown menu.
      3. Select the Destination volume from the left side dropdown menu.
      4. Be sure the Block Copy button is not selected or is ghosted.
      5. Click on the Clone button.
    Destination means the internal hard drive. Source means the external startup drive.
    Note that the Source and Destination drives are swapped for this last procedure.
    Malware Protection
    As for malware protection there are few if any such animals affecting OS X. Starting with Lion, Apple has included built-in malware protection that is automatically updated as necessary. To assure proper protection, update your system software when Apple releases new OS X updates for your computer.
    Helpful Links Regarding Malware Protection:
    1. Mac Malware Guide.
    2. Detecting and avoiding malware and spyware
    3. Macintosh Virus Guide
    For general anti-virus protection I recommend only using ClamXav, but it is not necessary if you are keeping your computer's operating system software up to date. You should avoid any other third-party software advertised as providing anti-malware/virus protection. They are not required and could cause the performance of your computer to drop.
    Cache Clearing
    I recommend downloading a utility such as TinkerTool System, OnyX 2.4.3, Mountain Lion Cache Cleaner 7.0.9, Maintenance 1.6.8, or Cocktail 5.1.1 that you can use for periodic maintenance such as removing old log files and archives, clearing caches, etc. Corrupted cache files can cause slowness, kernel panics, and other issues. Although this is not a frequent nor a recurring problem, when it does happen there are tools such as those above to fix the problem.
    If you are using Snow Leopard or earlier, then for emergency cleaning install the freeware utility Applejack.  If you cannot start up in OS X, you may be able to start in single-user mode from which you can run Applejack to do a whole set of repair and maintenance routines from the command line.  Note that AppleJack 1.5 is required for Leopard. AppleJack 1.6 is compatible with Snow Leopard. (AppleJack works with Snow Leopard or earlier.)
    Installing System Updates or Upgrades
    Repair the hard drive and permissions beforehand.
    Update your backups in case an update goes bad.
    Backup and Restore
    Having a backup and restore strategy is one of the most important things you can do to maintain your computer. Get an external Firewire drive at least equal in size to the internal hard drive and make (and maintain) a bootable clone/backup. You can make a bootable clone using the Restore option of Disk Utility. You can also make and maintain clones with good backup software. You can never have too many backups. Don't rely on just one. Make several using different backup utilities. My personal recommendations are (order is not significant):
         1. Carbon Copy Cloner
         2. Get Backup
         3. Deja Vu
         4. SuperDuper!
         5. Synk Pro
         6. Tri-Backup
    Visit The XLab FAQs and read the FAQs on maintenance and backup and restore.
    Always have a current backup before performing any system updates or upgrades.
    Final Suggestions
    Be sure you have an adequate amount of RAM installed for the number of applications you run concurrently. Be sure you leave a minimum of 10% of the hard drive's capacity or 20 GBs, whichever is greater, as free space. Avoid installing utilities that rely on Haxies, SIMBL, or that alter the OS appearance, add features you will rarely if ever need, etc. The more extras you install the greater the probability of having problems. If you install software be sure you know how to uninstall it. Avoid installing multiple new software at the same time. Install one at a time and use it for a while to be sure it's compatible.
    Additional reading may be found in:    
    1. Mac OS X speed FAQ
    2. Speeding up Macs
    3. Macintosh OS X Routine Maintenance
    4. Essential Mac Maintenance: Get set up
    5. Essential Mac Maintenance: Rev up your routines
    6. Five Mac maintenance myths
    7. How to Speed up Macs
    8. Myths of required versus not required maintenance for Mac OS X
    Referenced software can be found at CNet Downloads or MacUpdate.
    Most if not all maintenance is for troubleshooting problems. If your computer is running OK, then there isn't really a thing you need to do except repair the hard drive and permissions before installing any new system updates.

  • Safe to turn off time capsule when not using it?

    Should you turn off your time capsule when you are not using it or should you just leave it on all of the time?? I really don't want it to die on me... Thank you.

    see this thread: http://discussions.apple.com/thread.jspa?threadID=2416659&tstart=0.
    JGG

  • How to use thread only for progress bar.....

    Hello,
    I am working on an application which is taking time to load. Now I want to use a progress bar to tell the user of the application that It is taking time to load. How to do it... I read the Java swing tutorial and went through the example. Please tell me what to do. Because I am unfamiliar with Threads and I am not using thread anywhere in my application.

    You are using threads. All Java execution occurs on threads. Write a Java GUI and you're in a multithreaded environment - there's no way out of that.
    If your "application is a complex one" then you would be better advised to understand threads than to try and pretend that they don't exist. For a start, if you don't think you're using threads then you're destined to run in to all sorts of problems as regards an unresponsive GUI, as you're probably now finding out.

  • BufferedWriter can use threaded i/o?

    Dear all,
    I read BufferedWriter.java from java source code, and found that it is not using thread to flushBuffer. I am wondering if we use thread to write out buffer when buffer is full, whether it will improve the write performance? -- That is, when the buffer size > nChars (the capacity of the buffer), we just use another thread to write out this buffer.
    Is it possible to do so? How this can be implemented? Since I need to write out a very large file, but requires the processing time to be minimized.
       void flushBuffer() throws IOException {
              ensureOpen();
              if (nextChar == 0) return;
              out.write(cb, 0, nextChar);
              nextChar = 0;
       public void write(int c) throws IOException {
              ensureOpen();
              if (nextChar >= nChars)
                   flushBuffer();
              cb[nextChar++] = (char) c;
       }Thanks!

    No doubt it could be done, although there's obviously
    no flag to tell the existing BufferedWriters to do it.
    You would have to write your own version. One thread
    writing full buffers, another one creating new buffers
    and filling them. Could be an interesting project.
    Would also be interesting to find out whether that
    shortened the total time required to write the file at
    all.Thanks DrClap, I think I only need to modify the flushBuffer() method in BufferedWriter code, since all other write() method will call this method when the
    buffer is full. In flushBuffer(), first set nextChar = 0; then just create a thread for io output, such as:
    new WriterThread(buffer); // inner class
                              // in constructor call run()
    and in thread run method, do actually write:
    public void run() {
       if (buffer.length == 0) return;
       ensureOpen(); // ensure the writer is open
       out.write(buffer, 0, buffer.length ); // write out buffer
    }Is this ok?
    Thanks!

  • Connection between server and client using thread

    hi
    i am new to java..i hav done a program to connect a server and client...but i hav not used threads in it..
    so please tel me how to use threads and connect server and client..i tried it out not getin...i am havin thread exception...my program is as shown below
    SERVER PRG:
    import java.io.*;
    import java.net.*;
    public class Server{
    String clientsen;
    String serversen;
    public void go(){
    try{
         ServerSocket serverSock=new ServerSocket(6789);
         while(true) {
         Socket sock=serverSock.accept();
         BufferedReader inFromClient=new BufferedReader(new InputStreamReader(sock.getInputStream()));
         BufferedReader inFromuser=new BufferedReader(new InputStreamReader(System.in));
         DataOutputStream outToClient=new DataOutputStream(sock.getOutputStream());
         clientsen=inFromClient.readLine();
         System.out.println("From Client: "+clientsen);
         System.out.println("Reply mess to Client");
         serversen=inFromuser.readLine();
         outToClient.writeBytes(serversen+'\n');
    } catch(IOException ex) {
         ex.printStackTrace();
    public static void main(String[] args) {
         Server s = new Server();
         s.go();
         CLIENT PRG
    import java.lang.*;
    import java.util.*;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.net.*;
    import java.lang.Thread;
    import java.applet.Applet;
    class Client1
    public static void main(String argv[]) throws Exception
              String Sen;
              String modsen;
              BufferedReader inFromUser=new BufferedReader(new InputStreamReader(System.in));
    Socket clientSocket=new Socket("192.168.1.2",6789);
              DataOutputStream outToServer=new DataOutputStream(clientSocket.getOutputStream());
              BufferedReader inFromServer=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
              System.out.println("Enter the mess to be sent to server");
              Sen=inFromUser.readLine();
              outToServer.writeBytes(Sen + '\n');
              modsen=inFromServer.readLine();
              System.out.println("FROM SERVER: " +modsen);
              clientSocket.close();
    please send me the solution code for my problem...

    sorry for inconvenience...
    SERVER PROGRAM
      *import java.io.*;*
    *import java.net.*;*
    *public class MyRunnable implements Runnable*
       *public void run() {*
       *go();*
    *public void go(){*
    *try {*
        *String serversen;*
       *ServerSocket  welcomeSocket=new ServerSocket(6789);*
       *while(true)*
    *Socket connectionSocket=welcomeSocket.accept();*
    *//BufferedReader inFromClient=new BufferedReader(new //InputStreamReader(connectionSocket.getInputStream()));*
    *System.out.println("enter the mess to be sent to client");*
    *BufferedReader inFromuser=new BufferedReader(new InputStreamReader(System.in));*
    *DataOutputStream outToClient=new DataOutputStream(connectionSocket.getOutputStream());*
    *//clientsen=inFromClient.readLine();*
    *//System.out.println("From Client: "+clientsen);*
    *//System.out.println("Reply mess to Client");*
    *serversen=inFromuser.readLine();*
    *outToClient.writeBytes(serversen+'\n');*
    *} catch(IOException ex) {*
    *        ex.printStackTrace();*
    *class Server1{*
    *public static void main(String argv[]) throws Exception*
         *Runnable threadJob=new MyRunnable();*
    *Thread myThread=new Thread(threadJob);*
    *myThread.start();*
    *}*CLIENT PROGRAM
    import java.io.*;
    import java.net.*;
    class Client2
    public static void main(String argv[]) throws Exception
              //String Sen;
              String modsen;
              //BufferedReader inFromUser=new BufferedReader(new InputStreamReader(System.in));
    Socket clientSocket=new Socket("192.168.1.2",6789);
              //DataOutputStream outToServer=new DataOutputStream(clientSocket.getOutputStream());
              BufferedReader inFromServer=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
              //System.out.println("Enter the mess to be sent to server");
              //Sen=inFromUser.readLine();
         //     outToServer.writeBytes(Sen + '\n');
              modsen=inFromServer.readLine();
              System.out.println("FROM SERVER: " +modsen);
              clientSocket.close();
    this is the code which i hav used using thread but i am gwetin error..ts is the error
    Exception in thread "main" java.lang.NoSuchMethodError : Main

  • Related 2 CORE JAVA

    HAI..... dis is neeraja...
    I hav a question.... I wanna know how to link the HTML page to a frame by clicking on a button or menuItem using CORE JAVA without using servlets,jsp.... If anyone knows the answer plz... reply to dis as soon as possible...
    Thank 'U'

    Can anyone provide some info on this based on your empirical experience or alternate ways

  • Query is not using the cache

    We are on 7.3 and I have been doing some performance tuning.  I've noticed that even though a query is in the query aggregate in the cache monitor when I run it for the 1st time every morning it does not use the cache.  I traced it from ST05 and verified this.   However when I  run it the second time during the day it uses the cache.  The query cache mode is set to 5.  do you know why it does this?  I am using the exact same parameters when I run the query every time.

    You need to use following process of process chain: "Attribute change run (ATTRIBCHAN)". This process needs to be incorporated into your process chains which loads data into provider on top of which your query is based.
    See following links on topic how to build it:
    https://help.sap.com/saphelp_nw73/helpdata/en/4a/5da82c7df51cece10000000a42189b/frameset.htm
    https://help.sap.com/saphelp_nw70ehp1/helpdata/en/9a/33853bbc188f2be10000000a114084/content.htm
    cheers
    m./

  • Weblogic.kernel.Default not using all threads

    We are running weblogic 8.1 sp4 on HP Tru64 5.1.
    We have an admin server and 3 managed servers in a cluster.
    When monitoring the weblogic.kernal.Default execute threads through the weblogic console, threads 0 to 15 have zero total requests, and the user is marked '<WLS Kernal>'. Threads 16 to 24 share the entire workload with thousands of requests shared between them, and have user marked as 'n/a' (when idle).
    I have done a thread dump, and threads 0 to 15 just seem to be idle.
    This is the case for the admin server, server 1 and server 3. But server 2 actually shows all threads 0 to 24 as sharing the workload, and the user is 'n/a' for all threads.
    Is there a reason for this?
    Below is a snippet of the thread dump showing a thread that is has user '<WLS Kernel>':
    **** ExecuteThread: '3' for queue: 'weblogic.kernel.Default' thread 0x207d8e80 Stack trace:
    pc 0x03ff805c2cc8 sp 0x200026ecc00 __hstTransferRegisters (line -1)
    pc 0x03ff805b2384 sp 0x200026ecc00 __osTransferContext (line -1)
    pc 0x03ff805a3d20 sp 0x200026ecd90 __dspDispatch (line -1)
    pc 0x03ff805a309c sp 0x200026ecde0 __cvWaitPrim (line -1)
    pc 0x03ff805a0518 sp 0x200026ece80 __pthread_cond_wait (line -1)
    pc 0x03ffbff31558 sp 0x200026ecea0 monitor_wait (line 625)
    pc 0x03ffbff5ea48 sp 0x200026ecf10 JVM_MonitorWait (line 1037)
    pc 0x00003001304c sp 0x200026ecf20 -1: java/lang/Object.wait(J)V
    pc 0x0000302047dc sp 0x200026ecfd0 2: java/lang/Object.wait()V
    pc 0x000030204784 sp 0x200026ecfe0 8: weblogic/kernel/ExecuteThread.waitForRequest()V
    pc 0x0000302044ec sp 0x200026ed000 43: weblogic/kernel/ExecuteThread.run()V
    pc 0x03ffbff91b28 sp 0x200026ed030 unpack_and_call (line 100)
    pc 0x03ffbff89ca4 sp 0x200026ed040 make_native_call (line 331)
    pc 0x03ffbff27bb0 sp 0x200026ed0f0 interpret (line 368)
    pc 0x03ffbff36bf0 sp 0x200026ed9d0 jni_call (line 583)
    pc 0x03ffbff378d8 sp 0x200026eda60 jni_CallVoidMethodA (line 70)
    pc 0x03ffbff37980 sp 0x200026eda90 jni_CallVoidMethod (line 88)
    pc 0x03ffbff2ecf4 sp 0x200026edb10 java_thread_start (line 592)
    pc 0x03ffbff2e720 sp 0x200026edb30 thread_body (line 460)
    pc 0x03ff805cf278 sp 0x200026edc00 __thdBase (line -1)

    Grand central dispatch - infancy, not really doing its job, and I don't think apps have to be specifically written for HT, but they do have to not do things that they use to - prevent threads from going to sleep! or be parked.
    high usage is not necessarily high efficiency. often the opposite.
    Windows 7 seems to be optimized for multi-core thanks to a lot of reworking. Intel wants and knows it isn't possible to hand code, that the hardware has to be smarter, too. But the OS has a job, and right now I don't think it does it properly. Or handle memory.
    Gulftown's 12MB cache will help, and over all should be 20% more efficient doing its work.
    With dual processors, and it doesn't look like there are two quick path bridges, data shuffling has led to memory thrashing. Use to be page thrashing with not enough memory. Then core thrashing but having the cores, but not integrated (2008 is often touted as being greatest design so far, but it was FOUR dual-cores, 2009 was the first with a processor that really was new design and (native) 4-core.
    One core should be owned by the OS so it is always available for its own work and housekeeping.
    The iTunes audio bug last year showed how damaging and not to implement code and how a thread could usurp processing and add a high cpu temperature while basically doing nothing, sort of a denial of service attack on the processor - those 80*C temps people had.
    All those new technology features under development and not like OpenCL, GCD and even OpenGL are tested, mature but rather 1.0 foundation for the future. A year ahead of readiness.

  • Urgent please send code for this one ( write code by using core java)

    hi sir
    my question
    i am taking one square box .. and i divide that square in again four parts .. now i am placing one object in 1st box now i want to move that object to 2 box or third box... like that only if my object is in 1st box now i want to jump directly to 4th box
    i want that programing code the code will written BY USING CORE JAVA ONLY
    PLEASE HELP FOR THAT

    hi sirWhat if I'm a madam?
    i want that programing code Why did you post here asking for it?
    1) You are the Lead Architect at a world-class company and none of your staff of topnotch developers are able to handle this insidious task. You need to pull in outside resources for this noodler. You would use Dice, Monster, etc., but, by a freak coincidence, you happen to have had illicit trysts with the wives of several high-ranking executives in each of those companies, and as a result, have been blacklisted in perpetuity. You sought help here because you know that the denizens of this particular cyber-community are not only the best of the best of the best in the world of software development, we also happen--by yet another bizarre convergence of the unfahtomable Threads of Fate--to be the handsomest and best-endowed, dude-tube-wise. This is exactly what you need to distract your wife from your many concubines so you can continue with your plan for world dominance, which, of course, is but a small cog in the machina profunda that grinds unfailingly and inexorably toward your ultimate goal of the perfect tofu burrito.
    2) You are a lazy slimeball student who thinks it's acceptable to take credit for somebody else's work. You have no motivation, no ethics, and nothing to contribute to the society upon which you will become a bigger and more loathsome burden daily.

  • Dump complete java VM state as core dump (not via OS) possible?

    Hi everyone,
    I've a problem debugging an application.
    Background: Sometimes my application comes to a very unlikely state, which at the moment results in an error message. The stack trace alone has no great value, since this state is cause by the interaction of more than one thread. The state is resolved throwing an exception, the program continues normally.
    Goal: If I reach this state, I want to suspend the application, dump the complete state of all java threads, objects, ... (complete java memory core dump) to analyse it later.
    Question: Is there a possibility to generate such dumps?
    Just thinking:
    One posibility would be, to send a signal from the vm to some external program (e.g. udp packet), this program attaches a standard OS-level debugger (e.g. gdb under linux), dumps the core, resumes app, detach. But I guess reconstruction of internal VM state from complete dump is rather hard, is it?
    I've looked at jdb, to see if it has some java-core-dump functions, but it seems not to be so. Are there alternative implementations, or helper scripts that make jdb loop over all java object addresses and dump them?
    Does someone known about the jdb remote debugging interface? Is the protocol public, can I implement such a feature on myself?

    Hi everyone,
    I was looking for a way to dump the complete state of a JVM (all runing threads, objects, ...) and afterwards to analize the dumped data. I have found a thread(http://forum.java.sun.com/thread.jspa?threadID=735052) here in the forums with some explainations how this could be done using the Java 2 sdk 1.5.0 - troubleshooting tools (http://java.sun.com/j2se/1.5.0/docs/tooldocs/experimentaltools.html).
    I've made a small application, which starts a thread and just prints out continously some messages to the console.
    After that I attached with gdb to the running process as described, and generated a core file.
    Unfortunatelly on calling jdsadebugd with the core dump it throws the following exception:
    jsadebugd /..../jdk1.5.0_07/bin/java core.18294 DebServ
    Attaching to core core.18294 from executable /.../jdk1.5.0_07/bin/java and starting RMI services, please wait...
    Error attaching to core file or starting server: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the core file
    at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach0(Native Method)
    at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:258)
    at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:624)
    at sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:610)
    at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:323)
    at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:298)
    at sun.jvm.hotspot.HotSpotAgent.startServer(HotSpotAgent.java:234)
    at sun.jvm.hotspot.DebugServer.run(DebugServer.java:94)
    at sun.jvm.hotspot.DebugServer.main(DebugServer.java:29)
    at sun.jvm.hotspot.jdi.SADebugServer.main(SADebugServer.java:46)
    Even if I try to print the shared objects mapping with jmap it fails with the following message:
    jmap /.../jdk1.5.0_07/bin/java core.18294
    Attaching to core core.18294 from executable /.../jdk1.5.0_07/bin/java, please wait...
    Error attaching to core file: Can't attach to the core file
    Does anyone have an idea what goes wrong here?

  • How to invoke a jsp page from java which does not use Servlets?

    Hello,
    I am working in Documentum. I am trying to invoke a jsp page from another java page which does not use Servlets.
    I tried doing this by just instantiating the java class related to the jsp page from my present java class.In my java class related to the jsp page, I have defined onInit() and onRender() methods.
    Now, I am trying to call the jsp page from my present java class by just instantiating the java class related to the jsp page. This throws a java.lang.NullPointerException.
    Any comments or suggestions on this.Any help would be appreciated.
    Thanks,
    Ranjith M.V

    RanjithM.V wrote:
    Hello,
    Thanks for the reply. One important thing I forgot to mention. I am also using xml component.And?
    As this is the standard way used for coding in Documentum, I do not want to use Beans.Well, JSP's should, in and of themselves, contain no functional code. It should all be only display.
    Without that is it not possible?What did I say? I said,
    masijade wrote:
    It is possible, but I very, very, very, much doubt, that it would be worth the effort.And, if you don't know how, a forum is not truely going to be able to help you implement it (at least not in less than a few years time, at which point it would be outdated).
    >
    Appreciate your understanding and help.
    Thanks,
    Ranjith M.V

  • I need a timer function to ping the server every 5 secs??using threads.

    I need a timer function to ping the server every 5 secs??
    using threads...i have to use a thread coz i cant use Timer and Timer Task coz clients r on the JDK1.2 version.I have created a thread which keeps checking th ping msg & any server msg is pings 4 the1st time properly but then it just waits to read the response from server but it doesnt but the server shows that it has send the msgs to client???PLEASE HELP URGENT

    Few things are not clear from your post, like, are you using sockets and if you are, how are u reading writing to them (ur sample code would help)...
    Anyways if you are, are you doing accept on your socket in a while(true) loop or just once... If you do it only once you will get the first ping message but none afterwards if the other side closes and opens new sockets for every send... What I am suggesting is something like the following:
    ss = new ServerSocket(port);
    while(true)
         s = ss.accept();
         is = s.getInputStream();
         os = s.getOutputStream();
         reader = new BufferedReader(new InputStreamReader(is));
         writer = new BufferedWriter(new OutputStreamWriter(os));
         String in = reader.readLine();
            // do something with this string
            s.close();
            // put some check here to break out of this infinite loop
    }// end of While

Maybe you are looking for

  • HP LP2465 24" Wide External Monitor Unrecognized?

    I have a HP LP2465 24" Wide screen monitor. Similiar problem to ScottsMac message. Setup: The monitor has two DVI inputs/outputs. I have a DVI adapter to VGA dongle. The DVI end is plugged into the monitor and the free end is a VGA connector. I'm usi

  • Creating sequnces

    Hi all, I tried to create a sequence by formatting numbers. eg. instead of '1' get' 0001'. but it throws an error in oracle 10g express edition. Please guide me, where i have went wrong! CREATE SEQUENCE test_sequence START WITH to_number('1', '0999')

  • Macbook A1278 Lid/Sleep Failure

    Hello All, I have searched high and low, and I have found a lot of answers but nothing that has worked for my issues here. I have the Macbook 5,1 Aluminum A1278 2.4 GHz Intel Core 2 Duo. It was purchased with 2GB of ram total (1GB x 2 sticks), and th

  • HT6160 Apple Configurator and Guided Access

    Is there a way in Apple Configurator to set a Guided Access pass code and keep it when I push out the image to other iPads? I am using Apple Configurator 1.5

  • Find The Transaction for the given EXIT Name

    Hi Friends,                 This is my doubt,pls dont think in the other sense I know how to find the EXIT for a given Transaction. My question is that IS THERE IS ANY WAY TO FIND THE TRANSACTION FOR A GIVEN EXIT NAME.Could any one help me out on thi