Files . jar do not open

Asked

Viewed 1,077 times

0

Hello I would like a help, I created a basic java project but the file . jar does not open.

  • I already have the jdk set

Microsoft Windows [version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved.

C: Users Leo>java -version java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-B13) Java Hotspot(TM) Client VM (build 25.121-B13, Mixed mode, sharing)

  • I already created a path pro java

  • double click do not open the file

  • java -jar tbm nothing happens.

  • tried to open other files. jar and nothing

I don’t know what else to try.

1 answer

3

You forgot to indicate your main class in the jar. The 'c' flag indicates that you want to create a new jar file and 'f' the file name.

The 'and' flag (for entrypoint) creates or replaces the Main-Class manifest attribute. It can be used while creating or updating a JAR file. Use it to specify the application’s entry point without editing or creating the manifest file.

jar cfe arquivo.jar foo.Main foo/Main.class foo/Outra.class

Source: https://docs.oracle.com/javase/tutorial/deployment/jar/appman.html

Browser other questions tagged

You are not signed in. Login or sign up in order to post.