My JFrame appears and disappears

Hello,

I've started a simple java application, it is a JFrame with a JLabel.

so when I execute it (I'm using ant), the JFrame appears and dissapears.

This is my piece of code:

publicclass Isp1extends JFrame{

Isp1()

{

super("Hola");

}

publicvoid inicia(){

JLabel l=new JLabel("HOLA");

this.getContentPane().setLayout(new BorderLayout());

this.addWindowListener(new WindowAdapter(){

publicvoid windowClosing(WindowEvent e)

{

System.exit(0);

}

});

this.getContentPane().add(l, BorderLayout.CENTER);

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE );

}

publicstaticvoid main(String args[]){

Isp1 p=new Isp1();

p.inicia();

p.pack();

p.setVisible(true);

}

}

If I use JDialog everything runs right.

[1801 byte] By [SAKYa] at [2007-11-27 8:07:46]
# 1
I just ran your test and the Frame appeared just fine until I clicked on the close button.I'm not sure what the problem would be. What Ant command are you using to execute this?
bryanoa at 2007-7-12 19:50:31 > top of Java-index,Desktop,Core GUI APIs...
# 2

I've realized if I run with java command everything is ok.

This is my ant block:

<target name="run">

<java classname="Isp1">

<classpath>

<pathelement path="%CLASSPATH;${basedir}"/>

<fileset dir="${basedir}\clases">

<include name="*.class"/>

</fileset>

<fileset dir="${basedir}\gui">

<include name="*.class"/>

</fileset>

<pathelement location="${lib}"/>

</classpath>

</java>

</target>

SAKYa at 2007-7-12 19:50:31 > top of Java-index,Desktop,Core GUI APIs...
# 3
I've already found it.I add the parameter fork=true in the run target:<java classname="Isp1" fork="true">Thanks bryano!
SAKYa at 2007-7-12 19:50:31 > top of Java-index,Desktop,Core GUI APIs...