"Java Virtual Machine Launcher -A Java Exception has occured" error in Maven .jar file

When I use "java -jar [file name].jar" using cmd it works, but doucle cliking the .jar file give me an error. I use maven assembly plugin, and netbeans > build with dependencies
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.mycompany.ytdlp.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.mycompany.ytdlp.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
8 Replies
JavaBot
JavaBot3w ago
This post has been reserved for your question.
Hey @Rice! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
GeneralCore
GeneralCoreOP3w ago
This is the error
No description
dan1st
dan1st3w ago
you might want to try jarfix Essentially it looks like your OS doesn't correctly associate JAR files with how to open them
GeneralCore
GeneralCoreOP3w ago
Thank you @dan1st | Daniel
JavaBot
JavaBot3w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
dan1st
dan1st3w ago
Did it work?
GeneralCore
GeneralCoreOP3w ago
It did
JavaBot
JavaBot3w ago
Post Closed
This post has been closed by <@307017632287162369>.

Did you find this page helpful?