Results 1 to 6 of 6
  1. #1
    drw4d is offline Member
    Join Date
    Mar 2011
    Posts
    3
    Rep Power
    0

    Question Brand new to java ... window is closing

    Hello,

    I am brand new to java (jdk 6.0_24 installed, running Windows XP), and using BlueJ (3.0.4) as my editor/compiler. I've tried a couple different programs from a book I am using (Sams Teach Yourself Java 6), and I think they may be running. They compile just fine, and I am getting files with .java extensions. When I run the programs, a command window opens, which I would expect, but then it closes immediately, so I can't see any of the output.

    When I was learning C++, I figured out that I could add a variable and create a cin<< statement to that variable at the end of my program, leaving the window open until I entered that variable. But I don't know enough java at this point to try that, if that would even solve my issue.

    Any help here would be appreicated.

  2. #2
    drw4d is offline Member
    Join Date
    Mar 2011
    Posts
    3
    Rep Power
    0

    Default

    Okay, so I can sort of get things to work, but I suspect there things I could (should?) do differently.

    Within BlueJ, I am able to call the Main method, and it runs in the BlueJ Terminal Window. So I know that the code is correct. (Small yeh)

    I looked around the other threads here, and found this one (My first java program could not be executed..help), and so I tried to run my program from a cmd entry. Having the same issue miaaa00 had, I tried running my program using sunde887's suggestion (java -cp . ProgramName, and that worked. The program ran in the command window correctly. (Another small yeh)

    Is there something in either my classpath or class setting that I need to adjust? Is there a way to run this from WE as opposed to in either the IDE or a cmd window?

    classpath: C:\Program Files\Java\jdk1.6.0_24\lib\tools.jar
    path: C:\Program Files\Java\jdk1.6.0_24\bin
    directory: C:\Documents and Settings\Andrew\My Documents\Programs\Java\Week 1 (this has the .java files, .class files, and .ctxt files)
    Last edited by drw4d; 03-20-2011 at 04:36 PM.

  3. #3
    akiravelmont is offline Member
    Join Date
    Mar 2011
    Location
    bangalore
    Posts
    61
    Rep Power
    0

    Default Bluej

    sorry to say this,
    I worked on your query but the window is not disappears to me. why don't you try again. if the problem still occurs send me the entire program code. and one thing have you set the PATH variable?

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,404
    Rep Power
    20

    Default

    They compile just fine, and I am getting files with .java extensions.
    You save the source code to a file with a .java extension. The .java file is compiled to one or more .class files.

    Is there a way to run this from WE
    What's 'WE'?

    have you set the PATH variable?
    What does that have to do with the stated problem? (Answer: nothing)

    db

  5. #5
    akiravelmont is offline Member
    Join Date
    Mar 2011
    Location
    bangalore
    Posts
    61
    Rep Power
    0

    Default

    i didnt get you could you tell me in clear manner.

  6. #6
    akiravelmont is offline Member
    Join Date
    Mar 2011
    Location
    bangalore
    Posts
    61
    Rep Power
    0

Similar Threads

  1. Replies: 6
    Last Post: 11-19-2010, 06:41 AM
  2. BRAND new to Java (editor question)
    By hayden06f4i in forum New To Java
    Replies: 2
    Last Post: 10-20-2010, 10:11 PM
  3. how can we call Logout servlet by closing window
    By nagesh1811 in forum Java Servlet
    Replies: 2
    Last Post: 07-11-2008, 07:41 AM
  4. Brand New to Java needs directions
    By NatasjaA in forum New To Java
    Replies: 13
    Last Post: 04-07-2008, 04:34 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
  •