Generar .jar
Hola nuevamente
Ya te había hecho una pregunta que titulaba "generar un ejecutable en java" y tu respuesta fue excelente pero ahora tengo otra duda:
Tengo una aplicación de practica llamada Alexis.java cuya clase principal es Alexis.class:
import java.awt.*;
import java.awt.event.*;
//------------------------------------------------------------
//Clase Principal
public class Alexis{
//------------------------------------------------------------
//El Main
public static void main(String[] args) {
Alexis3 ventana=new Alexis3("Ventana de Alexis I");
ventana.show(true);
}
}
//------------------------------------------------------------
//metodo para cerrar la primera ventana
class cerrar extends WindowAdapter{
public void windowClosing(WindowEvent we){
System.exit(0);
}
}
//------------------------------------------------------------
//clase para la Ventana 2
class Alexis2 extends Frame{
public Button b3;
//------------------------------------------------------------
//Constructor
public Alexis2(String titulo){
super(titulo);
b3=new Button("Cerrar");
this.setLayout(null);
this.setBounds(50,100,170,140);
this.setBackground(Color.magenta);
this.setResizable(false);
b3.setBounds(30,90,50,20);
cerrar2 cv2=new cerrar2();
cerrar3 cv3=new cerrar3();
this.add(b3);
this.addWindowListener(cv2);
b3.addActionListener(cv3);
}
}
//------------------------------------------------------------
//clase para cerrar la ventana 2
class cerrar2 extends WindowAdapter{
public void windowClosing(WindowEvent we){
System.exit(0);
}
}
//------------------------------------------------------------
//clase para cerrrar la ventana 2 Atravez del boton b3
class cerrar3 implements ActionListener{
public void actionPerformed(ActionEvent ae){
System.exit(0);
}
}
//------------------------------------------------------------
//clase para la primera ventana
class Alexis3 extends Frame{
//------------------------------------------------------------
// Inicializacion de componentes
public Button b1;
public Button b2;
public Label l1;
//------------------------------------------------------------
//Constructor
public Alexis3(String titulo){
super(titulo);
b1=new Button("Alexis");
b2=new Button("Sánchez");
l1=new Label("Resultado");
this.add(b1);
this.add(b2);
this.add(l1);
b1.setBounds(30,90,50,20);
b2.setBounds(100,90,60,20);
l1.setBounds(60,70,60,20);
cerrar cv=new cerrar();
boton1 cl=new boton1();
boton2 cl2=new boton2();
this.setBackground(Color.magenta);
this.setLayout(null);
this.setBounds(100,100,170,140);
this.setResizable(false);
this.addWindowListener(cv);
b1.addActionListener(cl);
b2.addActionListener(cl2);
}
//------------------------------------------------------------
//metodo para cambiar el label l1 de a "Alexis" con el boton 1
//y Crear la ventana 2
class boton1 implements ActionListener{
public void actionPerformed(ActionEvent ae){
l1.setText("Alexis");
Alexis2 ventana2=new Alexis2("Ventana de Alexis II");
ventana2.show(true);
}
}
//------------------------------------------------------------
//metodo para cambiar el label l1 de a "Sánchez" con el boton 2
class boton2 implements ActionListener{
public void actionPerformed(ActionEvent ae){
l1.setText("Sánchez");
}
}
}
El problema es que al intentar generar el .jar y hacer doble click sobre este no reacciona
La linea de comando que utilizo para generarlo es similar a la siguiente:
jar cvf Alexis.jar *
¿Qué estoy haciendo mal y como lo resuelvo?
Gracias Anticipadas
Saludos
Ya te había hecho una pregunta que titulaba "generar un ejecutable en java" y tu respuesta fue excelente pero ahora tengo otra duda:
Tengo una aplicación de practica llamada Alexis.java cuya clase principal es Alexis.class:
import java.awt.*;
import java.awt.event.*;
//------------------------------------------------------------
//Clase Principal
public class Alexis{
//------------------------------------------------------------
//El Main
public static void main(String[] args) {
Alexis3 ventana=new Alexis3("Ventana de Alexis I");
ventana.show(true);
}
}
//------------------------------------------------------------
//metodo para cerrar la primera ventana
class cerrar extends WindowAdapter{
public void windowClosing(WindowEvent we){
System.exit(0);
}
}
//------------------------------------------------------------
//clase para la Ventana 2
class Alexis2 extends Frame{
public Button b3;
//------------------------------------------------------------
//Constructor
public Alexis2(String titulo){
super(titulo);
b3=new Button("Cerrar");
this.setLayout(null);
this.setBounds(50,100,170,140);
this.setBackground(Color.magenta);
this.setResizable(false);
b3.setBounds(30,90,50,20);
cerrar2 cv2=new cerrar2();
cerrar3 cv3=new cerrar3();
this.add(b3);
this.addWindowListener(cv2);
b3.addActionListener(cv3);
}
}
//------------------------------------------------------------
//clase para cerrar la ventana 2
class cerrar2 extends WindowAdapter{
public void windowClosing(WindowEvent we){
System.exit(0);
}
}
//------------------------------------------------------------
//clase para cerrrar la ventana 2 Atravez del boton b3
class cerrar3 implements ActionListener{
public void actionPerformed(ActionEvent ae){
System.exit(0);
}
}
//------------------------------------------------------------
//clase para la primera ventana
class Alexis3 extends Frame{
//------------------------------------------------------------
// Inicializacion de componentes
public Button b1;
public Button b2;
public Label l1;
//------------------------------------------------------------
//Constructor
public Alexis3(String titulo){
super(titulo);
b1=new Button("Alexis");
b2=new Button("Sánchez");
l1=new Label("Resultado");
this.add(b1);
this.add(b2);
this.add(l1);
b1.setBounds(30,90,50,20);
b2.setBounds(100,90,60,20);
l1.setBounds(60,70,60,20);
cerrar cv=new cerrar();
boton1 cl=new boton1();
boton2 cl2=new boton2();
this.setBackground(Color.magenta);
this.setLayout(null);
this.setBounds(100,100,170,140);
this.setResizable(false);
this.addWindowListener(cv);
b1.addActionListener(cl);
b2.addActionListener(cl2);
}
//------------------------------------------------------------
//metodo para cambiar el label l1 de a "Alexis" con el boton 1
//y Crear la ventana 2
class boton1 implements ActionListener{
public void actionPerformed(ActionEvent ae){
l1.setText("Alexis");
Alexis2 ventana2=new Alexis2("Ventana de Alexis II");
ventana2.show(true);
}
}
//------------------------------------------------------------
//metodo para cambiar el label l1 de a "Sánchez" con el boton 2
class boton2 implements ActionListener{
public void actionPerformed(ActionEvent ae){
l1.setText("Sánchez");
}
}
}
El problema es que al intentar generar el .jar y hacer doble click sobre este no reacciona
La linea de comando que utilizo para generarlo es similar a la siguiente:
jar cvf Alexis.jar *
¿Qué estoy haciendo mal y como lo resuelvo?
Gracias Anticipadas
Saludos
1 Respuesta
Respuesta
1