Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Java Program stopped working

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Program stopped working

    Hi. I hope someone could help me on this. I have a java program which would display a message dialog box. The problem is it would stopped working before even displaying the message dialog box. This is my code.
    import javax.swing.JOptionPane;

    public class HelloDialog
    {
    public static void main(String [] args)
    {
    JOptionPane.showMessageDialog(null, "Hello World!");
    }
    }

    There is a pop-up window which would say "Java(TM) Platform SE binary has stopped working."
    I am using textpad.
    What should I do with this?
    Last edited by Sheila Mae Mercado; March 16th, 2014 at 07:33 AM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Program stopped working

    Open a command prompt window, change to the directory with the HelloDialog.class file and enter:
    java HelloDialog

    copy the full contents of the command prompt window and paste it here. If there are other error messages we can see.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Mar 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Program stopped working

    This is what I did.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    c:Users\neo>D:\java\HelloDialog.class
    c:Users\neo> java HelloDialog
    Error: Could not find or load main class HelloDialog
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    I am not sure if I'm doing the right thing on the command prompt.. I'm sorry.
    Last edited by Sheila Mae Mercado; March 16th, 2014 at 07:57 AM.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Program stopped working

    Could not find or load main class HelloDialog
    The java program could not find the HelloDialog.class file.
    Check that the file exists. It is created by the javac program.
    Look at the tutorial for help: "Hello World!" for Microsoft Windows (The Java™ Tutorials > Getting Started > The "Hello World!" Application)
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Mar 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Program stopped working

    I followed the steps on your link and when it compiles, I typed dir in the command and this is the result

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\neo>D:

    D:\>cd java

    D:\java>dir
    Volume in drive D is DATA
    Volume Serial Number is 009E-98D1

    Directory of D:\java

    03/16/2014 08:42 PM <DIR> .
    03/16/2014 08:42 PM <DIR> ..
    03/16/2014 08:31 PM 452 HelloDialog.class
    03/16/2014 08:31 PM 252 HelloDialog.java
    03/14/2014 09:16 PM 458 Sample.class
    01/27/2014 07:28 PM 202 Sample.java
    01/27/2014 08:46 PM 732 TestPassByValue.class
    01/27/2014 08:46 PM 259 TestPassByValue.java
    6 File(s) 2,355 bytes
    2 Dir(s) 232,324,845,568 bytes free

    D:\java>"C:\Program Files\Java\jdk1.7.0_51\bin\javac" HelloDialog.java

    D:\java>dir
    Volume in drive D is DATA
    Volume Serial Number is 009E-98D1

    Directory of D:\java

    03/16/2014 08:42 PM <DIR> .
    03/16/2014 08:42 PM <DIR> ..
    03/16/2014 10:13 PM 452 HelloDialog.class
    03/16/2014 08:31 PM 252 HelloDialog.java
    03/14/2014 09:16 PM 458 Sample.class
    01/27/2014 07:28 PM 202 Sample.java
    01/27/2014 08:46 PM 732 TestPassByValue.class
    01/27/2014 08:46 PM 259 TestPassByValue.java
    6 File(s) 2,355 bytes
    2 Dir(s) 232,324,845,568 bytes free

    D:\java>java HelloDialog

    D:\java>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    I just get the same result just like when I am using textpad. It would still stop working

    --- Update ---

    When I am coding with only text as output, it would work properly but when I tried the dialog box, it would stop working

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Program stopped working

    The only thing I can think of is to uninstall java and reinstall it.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Member
    Join Date
    Feb 2014
    Posts
    180
    Thanks
    0
    Thanked 48 Times in 45 Posts

    Default Re: Java Program stopped working

    I've looked this up a bit, and it seems there can be a number of causes.

    Firstly, your Windows version is 6.1.7601. Do you have Windows 7 SP1 or Windows Server 2008 R2 SP1?

    Secondly, copy the source code at http://docs.oracle.com/javase/tutori...orldSwing.java, and compile and run it via command line. Do you still see the "Java(TM) Platform SE binary has stopped working" error? If you do, grab a screenshot of the error message pop up window and post it here.

    There are a few things that you can try in the following order.

    1. End stale/conflicting java process

    a) Press Alt+Ctrl+Del.
    b) Start up Task Manager.
    c) Under Process Tab, locate "javaw.exe [Java™ Platform SE Library]" or "java.exe".
    d) If there is such a process, select it and click on the "End Process" button. If there are more than 1, repeat for all of them.

    Check if the problem recurs.

    2. Clean virus infection

    It seems that virus infection in your PC can cause this. Try downloading Microsoft Safety Scanner - Free Virus Scan with the Microsoft Safety Scanner and scan your PC.

    After that reboot your PC, and check if the problem recurs.

    3. 32/64-bit Java

    Run "java -version". See if it mentions "64-Bit" anywhere in the command output.

    4. Reinstall Java

    As Norm suggested, try uninstalling and reinstalling Java. As you uninstall Java, check to see if you have multiple versions of Java installed. If you have, uninstall all of them.

    Also, if from #3 the output from the "java -version" command mentions "64-Bit", after uninstalling Java, try installing the 32-bit version.

    Good luck!

Similar Threads

  1. Program not working
    By KSR in forum What's Wrong With My Code?
    Replies: 10
    Last Post: September 19th, 2013, 04:31 AM
  2. Replies: 3
    Last Post: June 5th, 2013, 02:46 PM
  3. When I try to debug.. it says Your (app name) has stopped.
    By javapol in forum Android Development
    Replies: 2
    Last Post: April 5th, 2013, 08:13 PM
  4. Post Corrected - Java Detection Script Worked, then Stopped Working Very Recently
    By universityofky in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 22nd, 2013, 06:32 PM
  5. Replies: 4
    Last Post: January 27th, 2009, 12:03 AM