It would be great if someone could help me figure out why this code isn’t working. I’ve been trying to run it as a project but idk what’s wrong.
package proyecto_dsii;
//Libraries declaration
import javax.swing.JOptionPane; //Graphic output library
public class Proyecto_DSII {
public static void main(String[] args) {
//Variable declaration
String OpcMenu = "0"; //Menu cycle control variable (Variable de control de ciclo del Menu)
//Menu
do{
OpcMenu = JOptionPane.showInputDialog(
null,
"------ MENU PRINCIPAL -----\n\n"+
" 1. Vectores y Arrays\n"+
" 2. Pilas\n"+
" 3. Listas\n"+
" 4. Árboles\n"+
" S. Salir del programa",
"Selecciona una opción",
JOptionPane.INFORMATION_MESSAGE);
switch(OpcMenu){
case"1":
Mostrar_Msj( "Has seleccionado Vectores y Arrays",
"Vectores y Arrays",1);
break;
case"2":
Mostrar_Msj("Has seleccionado pilas",
"Pilas",1);
break;
case"3":
Mostrar_Msj("Ha seleccionado listas",
"Listas",1);
break;
case"4":
Mostrar_Msj("Ha selecciones Árboles",
"Árboles",1);
break;
case"S", "s":
Mostrar_Msj("Gracias y hasta pronto!",
"Salir del programa", 1);
break;
default:
JOptionPane.showMessageDialog(
null,
"Has seleccioando una opción no válida",
"No válida",
JOptionPane.ERROR_MESSAGE);
break;
}
}while(!"S".equals(OpcMenu.toUpperCase())); //Salir
}
//Método para desplegar mensajes
public static void Mostrar_Msj(
String Mensaje, String Titulo, int icono){
switch(icono){
case 1 -> JOptionPane.showMessageDialog(
null,
Mensaje,
Titulo,
JOptionPane.INFORMATION_MESSAGE);
case 2 -> JOptionPane.showMessageDialog(
null,
Mensaje,
Titulo,
JOptionPane.WARNING_MESSAGE);
default -> JOptionPane.showMessageDialog(
null,
Mensaje,
Titulo,
JOptionPane.ERROR_MESSAGE);
}
}
//Metodo para desplegar el submenu"
public static void Menu_VectoresArray(String OpcMenu){
do{
OpcMenu = JOptionPane.showInputDialog(
null,
"------ MENU VECTORESYARRAYS -----\n\n"+
" 1. Vectores y Arrays\n"+
" 2. Pilas\n"+
" 3. Listas\n"+
" 4. Árboles\n"+
" S. Salir del programa",
"Selecciona una opción",
JOptionPane.INFORMATION_MESSAGE);
switch(OpcMenu){
case "1":
//Mostrar_Msj
}
}while(!"S".equals(OpcMenu.toUpperCase()));
}
}
//static: instanciar la clase
//void: no return
…
BUILD FAILURE
…
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:exec (default-cli) on project Proyecto_DSII1: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
It’s a Maven problem. It gives you a suggestion. Did you re-run Maven using the -e and -X switches turned on? Please do so.
This SO answer might fix your problem: stackoverflow.com/questions/23235430/…
You are not providing enough information to reproduce the issue.