Why would this not work?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hegemony Cricket

    Why would this not work?

    Very simple Java program. Just create a frame and show it. All it prints,
    however, is "here1" -- it seems to be hanging on the "Frame f = new Frame();"
    line. Very frustrating. Why would this be happening?

    (FYI this is on Mac PowerPC G4 running Mac OS X version 10.2.8.)
    ----

    import java.awt.*;

    public class test
    {
    public static void main( String[] args )
    {
    System.out.prin tln( "here1" );
    Frame f = new Frame();
    System.out.prin tln( "here2" );
    f.setSize( new Dimension( 500, 500 ) );
    System.out.prin tln( "here3" );
    f.setVisible( true );
    System.out.prin tln( "here4" );
    }
    }
  • Gregory Weston

    #2
    Re: Why would this not work?

    In article <ebc6abe1.04052 52243.4ae916cc@ posting.google. com>,
    schnitzi@gmail. com (Hegemony Cricket) wrote:
    [color=blue]
    > Very simple Java program. Just create a frame and show it. All it prints,
    > however, is "here1" -- it seems to be hanging on the "Frame f = new Frame();"
    > line. Very frustrating. Why would this be happening?
    >
    > (FYI this is on Mac PowerPC G4 running Mac OS X version 10.2.8.)
    > ----
    >
    > import java.awt.*;
    >
    > public class test
    > {
    > public static void main( String[] args )
    > {
    > System.out.prin tln( "here1" );
    > Frame f = new Frame();
    > System.out.prin tln( "here2" );
    > f.setSize( new Dimension( 500, 500 ) );
    > System.out.prin tln( "here3" );
    > f.setVisible( true );
    > System.out.prin tln( "here4" );
    > }
    > }[/color]

    Have you tried running under the debugger? I get all 4 output lines. I
    _also_ get "-[NSJavaVirtualMa chine initWithClassPa th:] cannot
    instantiate a Java virtual machine" on the new Frame() line, but the
    window does display at what appears to be the correct size.

    --
    Standard output is like your butt. Everyone has one. When using a bathroom,
    they all default to going into a toilet. However, a person can redirect his
    "standard output" to somewhere else, if he so chooses. - Jeremy Nixon

    Comment

    • Andrew Regan

      #3
      Re: Why would this not work?

      I ran it under WinXP in Eclipse and also got all 4 outputs. It seems
      to work fine and I can't see anything wrong with the code. You can't
      close the window however because that behavior has not been defined
      yet.

      - Andrew

      Comment

      • Gregory Weston

        #4
        Re: Why would this not work?

        In article <270c4838.04052 60735.32f6511b@ posting.google. com>,
        droid38@hotmail .com (Andrew Regan) wrote:
        [color=blue]
        > I ran it under WinXP in Eclipse and also got all 4 outputs. It seems
        > to work fine and I can't see anything wrong with the code. You can't
        > close the window however because that behavior has not been defined
        > yet.
        >
        > - Andrew[/color]

        I think you're missing the point, though. The code you posted works
        here. Ergo I ask if you have run it under the debugger on the platform
        where you're having trouble at your location.

        --
        Standard output is like your butt. Everyone has one. When using a bathroom,
        they all default to going into a toilet. However, a person can redirect his
        "standard output" to somewhere else, if he so chooses. - Jeremy Nixon

        Comment

        • perry anderson

          #5
          Re: Why would this not work?

          you've set a size, however a location wouldn't go astray

          - perry


          Hegemony Cricket wrote:[color=blue]
          > Very simple Java program. Just create a frame and show it. All it prints,
          > however, is "here1" -- it seems to be hanging on the "Frame f = new Frame();"
          > line. Very frustrating. Why would this be happening?
          >
          > (FYI this is on Mac PowerPC G4 running Mac OS X version 10.2.8.)
          > ----
          >
          > import java.awt.*;
          >
          > public class test
          > {
          > public static void main( String[] args )
          > {
          > System.out.prin tln( "here1" );
          > Frame f = new Frame();
          > System.out.prin tln( "here2" );
          > f.setSize( new Dimension( 500, 500 ) );
          > System.out.prin tln( "here3" );
          > f.setVisible( true );
          > System.out.prin tln( "here4" );
          > }
          > }[/color]

          Comment

          Working...