Page 1 of 2 12 LastLast
Results 1 to 20 of 23
  1. #1
    Tawi is offline Senior Member
    Join Date
    Feb 2013
    Posts
    118
    Rep Power
    0

    Default Please help and don't close this thread

    Please open this: [ - shrink your URLs and get paid!] and tell me the reason Java process calculation in this program very long. Please do not close this because all of the advice was implemented by me but I get no good result.

    Mod edit: suspicious link removed
    Last edited by JosAH; 02-22-2014 at 05:06 AM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Please help and don't close this thread

    all of the advice was implemented by me
    Please copy the results of the debug techniques that were suggested and paste them here.
    There were two different suggestions:
    1) profiling
    2) computing times that sections of code took to execute and print those times out


    The other post on this same topic: Why does Java process things very long?
    Last edited by Norm; 02-22-2014 at 01:30 AM.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,810
    Rep Power
    5

    Default Re: Please help and don't close this thread

    No one is going to visit that site. You already dumped your code here --> Please help with my program. Six posts of it. No one is going to spend the time to analyze all of that. You need to learn the fundamentals of programming and design. I suggest you start with The Java™ Tutorials and a good book. Please stop asking for help on this.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  4. #4
    Tawi is offline Senior Member
    Join Date
    Feb 2013
    Posts
    118
    Rep Power
    0

    Default Re: Please help and don't close this thread

    I posted the result in the previous thread for profiling. About the computing time, Java does not do any things after I click the button that is being named "Proses" by me. So? What next? If you don't believe me, download the file or let me dump the code in this thread ok?
    Last edited by Tawi; 02-22-2014 at 04:49 AM.

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Please help and don't close this thread

    I posted the result in the previous thread for profiling.
    Please try it again and make sure there are no errors. When posting make sure to copy all of the contents of the command prompt window including the command line that started the execution.

    Java do not do any things after I click the button
    Then you need to add lots more calls to the println() method to show where the code is being executed. Be sure to put a println() before and after every method call. For example:
    Java Code:
      long startTime1 = System.currentTimeMillis();  // save start time
      System.out.println("Calling method1 at "+startTime1);
      method1();  //  call method1
      System.out.println("end method1 duration="+(System.currentTimeMillis()-startTime1)); //  report how long it took
    You should add the above around ALL method calls.

    The output for each method call should look like this:
    Calling method1 at 1393035987338
    end method1 duration=3328
    Last edited by Norm; 02-22-2014 at 04:29 AM.
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    Tawi is offline Senior Member
    Join Date
    Feb 2013
    Posts
    118
    Rep Power
    0

    Default Re: Please help and don't close this thread

    Error: Could not find or load main class C:\Documents

    Flat profile of 0.62 secs (50 total ticks): main

    Interpreted + native Method
    8.2% 0 + 4 java.io.WinNTFileSystem.canonicalize0
    4.1% 0 + 2 java.io.FileInputStream.open
    2.0% 0 + 1 java.lang.Class.forName0
    2.0% 1 + 0 sun.launcher.LauncherHelper$ResourceBundleHolder.< clini
    t>
    2.0% 1 + 0 java.util.zip.ZipFile$ZipFileInputStream.close
    2.0% 0 + 1 java.io.WinNTFileSystem.getBooleanAttributes
    20.4% 2 + 8 Total interpreted

    Thread-local ticks:
    2.0% 1 Blocked (of total)
    79.6% 39 Class loader

    Global summary of 0.62 seconds:
    100.0% 50 Received ticks
    2.0% 1 Compilation
    78.0% 39 Class loader


    Done, so? What does this mean? What next?

    I already did it but Java did not do any things after I clicked the button, so? What next?

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Please help and don't close this thread

    Where is the commandline that started the test? There should be a line that starts like:
    java -Xprof ....

    That report says the program finished execution in less than one second? Where is the problem then?

    Here is an example of what needs to be posted:
    Java Code:
    Running: D:\Java\jdk1.7.0_45\bin\java.exe -Xprof -cp . TestCode16
    
    Calling method1 at 1393036652564
    end method1 duration=2608
    
    Flat profile of 2.66 secs (106 total ticks): main
      Interpreted + native   Method                        
      0.9%     1  +     0    java.io.File.equals
      0.9%     1  +     0    java.nio.DirectLongBufferU.<clinit>
      0.9%     1  +     0    TestCode16.method1
      2.8%     3  +     0    Total interpreted
         Compiled + native   Method                        
     97.2%   103  +     0    TestCode16.method1
     97.2%   103  +     0    Total compiled
    
    0 error(s)
    Last edited by Norm; 02-22-2014 at 04:38 AM.
    If you don't understand my response, don't ignore it, ask a question.

  8. #8
    Tawi is offline Senior Member
    Join Date
    Feb 2013
    Posts
    118
    Rep Power
    0

    Default Re: Please help and don't close this thread

    Try to download and run the program. After that please write your computer specifications if you can run it. If I need more sophisticated computer to run the program please tell me the minimum requirements to be able to run the program because Java does not do any things in here.

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Please help and don't close this thread

    If you are not going to follow any of the advice given to you, what is the use of keeping this thread open?
    It's a waste of time to repeat what has already been said on the two other threads.

    Try to do one or both of the debugging techniques you have been shown.

    A bit of history: http://forums.devshed.com/java-help-...am-944098.html
    Last edited by Norm; 02-22-2014 at 05:18 AM.
    If you don't understand my response, don't ignore it, ask a question.

  10. #10
    Tawi is offline Senior Member
    Join Date
    Feb 2013
    Posts
    118
    Rep Power
    0

    Default Re: Please help and don't close this thread

    Flat profile of 0.42 secs (26 total ticks): main

    Interpreted + native Method
    4.0% 0 + 1 java.util.zip.ZipFile.open
    4.0% 1 + 0 java.lang.AbstractStringBuilder.append
    4.0% 1 + 0 java.io.BufferedReader.readLine
    4.0% 0 + 1 java.io.WinNTFileSystem.getBooleanAttributes
    16.0% 2 + 2 Total interpreted

    Thread-local ticks:
    3.8% 1 Blocked (of total)
    84.0% 21 Class loader


    Global summary of 0.42 seconds:
    100.0% 26 Received ticks
    23.1% 6 Compilation
    80.8% 21 Class loader

    The full one:
    Error: Could not find or load main class and

    Flat profile of 0.04 secs (3 total ticks): main

    Interpreted + native Method
    50.0% 0 + 1 java.util.zip.ZipFile.getEntry
    50.0% 0 + 1 Total interpreted

    Thread-local ticks:
    33.3% 1 Blocked (of total)
    50.0% 1 Class loader


    Global summary of 0.04 seconds:
    100.0% 3 Received ticks
    33.3% 1 Class loader

    I did it. The problem is I do not know your computer specifications. If you can run the program well, please tell me your computer specifications. In other words, what kind of minimum computer specifications shall I use to run the program? The Java reports no error, so?
    Last edited by Tawi; 02-22-2014 at 05:26 AM.

  11. #11
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Please help and don't close this thread

    You need to copy ALL of the contents of the command prompt window and paste it here.
    You are wasting time by not following instructions.

    What about adding the println()s?
    If you don't understand my response, don't ignore it, ask a question.

  12. #12
    Tawi is offline Senior Member
    Join Date
    Feb 2013
    Posts
    118
    Rep Power
    0

    Default Re: Please help and don't close this thread

    No content in the command prompt. I revised the code heavily. Where shall I put the println()?
    Last edited by Tawi; 02-22-2014 at 05:31 AM.

  13. #13
    milovan is offline Senior Member
    Join Date
    Jan 2011
    Location
    Belgrade, Serbia
    Posts
    301
    Rep Power
    4

    Default Re: Please help and don't close this thread

    what you use to run this program? some IDE or command prompt (terminal)

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Please help and don't close this thread

    Where shall I put the println()?
    See post#5
    If you don't understand my response, don't ignore it, ask a question.

  15. #15
    AlexGraal is offline Señor Member
    Join Date
    Jan 2014
    Posts
    184
    Rep Power
    0

    Default Re: Please help and don't close this thread

    I'm so confused by this thread. What do you even want help with?

    Typically, if I've got a complicated program:
    Java Code:
    class complicatedProgram {
      public static void main ( String[] args ) {
        String s = "hey";
        int a1 = 67;
        int a2 = 89;
        int total = add(a1, a2);
        int a3 = convertToInt(s);
        int finalTotal = add(total, a3);
        String answer = convertToString(total);
      }
      //methods for add, convertToInt, and convertToString here
    }
    and it runs very slowly - or simply doesn't finish, I add println()s to tell me where the actual time is taking.

    So I would do this:
    Java Code:
    class complicatedProgram {
      public static void main ( String[] args ) {
        String s = "hey";
        int a1 = 67;
        int a2 = 89;
        System.out.println("Call 1");
        int total = add(a1, a2);
        System.out.println("Call 2");
        int a3 = convertToInt(s);
        System.out.println("Call 3");
        int finalTotal = add(total, a3);
        System.out.println("Call 4");
        String answer = convertToString(total);
        System.out.println("Call 5");
      }
      //methods for add, convertToInt, and convertToString here
    }
    Then, I can see what the last call is. After that call is the line that is taking forever/very long. Helps you catch infinite loops and such.

  16. #16
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,810
    Rep Power
    5

    Default Re: Please help and don't close this thread

    That's all been covered before with this person. Two of the OP's threads have been closed. And similar posts are at JavaRanch where the advice and frustration from the repliers has been the same.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  17. #17
    AlexGraal is offline Señor Member
    Join Date
    Jan 2014
    Posts
    184
    Rep Power
    0

    Default Re: Please help and don't close this thread

    Well until the thread is closed, there is nothing to do but post answers.

    Some people don't understand English very well. Others simply may need to see an answer a certain way to understand or may not be as quick as you.

    It won't hurt to restate what somebody already said.

  18. #18
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,810
    Rep Power
    5

    Default Re: Please help and don't close this thread

    It has nothing to do with understanding English. It is clear the poster understood what was being asked. The poster continued to refuse to follow the advice. Of course, you may do as you see fit.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  19. #19
    Tawi is offline Senior Member
    Join Date
    Feb 2013
    Posts
    118
    Rep Power
    0

    Default Re: Please help and don't close this thread

    Quote Originally Posted by jim829 View Post
    That's all been covered before with this person. Two of the OP's threads have been closed. And similar posts are at JavaRanch where the advice and frustration from the repliers has been the same.

    Regards,
    Jim
    Sirs, I am sorry if you think that I am rude but after I put the println statement, the other button become long at the time they are processing, what shall I do?

    I did all of your advise. So? What next?
    Last edited by Tawi; 02-23-2014 at 06:04 AM.

  20. #20
    Tawi is offline Senior Member
    Join Date
    Feb 2013
    Posts
    118
    Rep Power
    0

    Default Re: Please help and don't close this thread

    Quote Originally Posted by Norm View Post
    Please try it again and make sure there are no errors. When posting make sure to copy all of the contents of the command prompt window including the command line that started the execution.


    Then you need to add lots more calls to the println() method to show where the code is being executed. Be sure to put a println() before and after every method call. For example:
    Java Code:
      long startTime1 = System.currentTimeMillis();  // save start time
      System.out.println("Calling method1 at "+startTime1);
      method1();  //  call method1
      System.out.println("end method1 duration="+(System.currentTimeMillis()-startTime1)); //  report how long it took
    You should add the above around ALL method calls.

    The output for each method call should look like this:
    I did this sirs but the Java did not giving any outputs. It just did not show any things.
    Last edited by Tawi; 02-23-2014 at 06:06 AM. Reason: Language mistake

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 12-11-2012, 12:35 PM
  2. Thread doesn't close
    By fioan89 in forum Threads and Synchronization
    Replies: 0
    Last Post: 10-21-2011, 02:07 PM
  3. How to close this thread? (Socket listener)
    By zardos in forum New To Java
    Replies: 5
    Last Post: 03-02-2011, 11:27 PM
  4. Replies: 13
    Last Post: 04-09-2010, 12:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •