By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,469 Members | 1,885 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,469 IT Pros & Developers. It's quick & easy.

Why would this not work?

P: n/a
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.println( "here1" );
Frame f = new Frame();
System.out.println( "here2" );
f.setSize( new Dimension( 500, 500 ) );
System.out.println( "here3" );
f.setVisible( true );
System.out.println( "here4" );
}
}
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <eb**************************@posting.google.com >,
sc******@gmail.com (Hegemony Cricket) wrote:
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.println( "here1" );
Frame f = new Frame();
System.out.println( "here2" );
f.setSize( new Dimension( 500, 500 ) );
System.out.println( "here3" );
f.setVisible( true );
System.out.println( "here4" );
}
}


Have you tried running under the debugger? I get all 4 output lines. I
_also_ get "-[NSJavaVirtualMachine initWithClassPath:] 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
Jul 17 '05 #2

P: n/a
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
Jul 17 '05 #3

P: n/a
In article <27**************************@posting.google.com >,
dr*****@hotmail.com (Andrew Regan) wrote:
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


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
Jul 17 '05 #4

P: n/a
you've set a size, however a location wouldn't go astray

- perry
Hegemony Cricket wrote:
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.println( "here1" );
Frame f = new Frame();
System.out.println( "here2" );
f.setSize( new Dimension( 500, 500 ) );
System.out.println( "here3" );
f.setVisible( true );
System.out.println( "here4" );
}
}


Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.