JAVA: Error: the main class Confirming2_App was not found or loaded

1

I have made a java GUI application with Swing and Netbeans. I can run it without problems from Netbeans or from console inside the directory of the application, nevertheless when taking the .jar to another directory (for example the desktop) I get the error of the title of this question. I've also tried to convert the .jar to .exe using Launch4j but I get the same error again, in this case the .jar if I get it from the application directory.

Does anyone know what can be done?

Thanks in advance.

    
asked by Felipe Ruiz 30.05.2017 в 16:23
source

2 answers

1

Thanks to everyone for your contributions, in the end the error was that Netbeans does not include when compiling the external libraries. In this tutorial you can see the steps I have followed:

link

    
answered by 30.05.2017 в 17:35
1

Try to compile it with dependencies, here is a code taken from how do i compile a java file that has jar dependencies

For windows:

javac -cp ".;/dir/commons.jar;/dir/more_jar_files.jar" MyClass.java

For unix or mac

javac -cp ".:/dir/commons.jar:/dir/more_jar_files.jar" MyClass.java

Use

javac -cp <ruta al jar> MyClass.java
    
answered by 30.05.2017 в 17:26