How to open/run .jar file (double-click not working)?

前端 未结 15 1136
陌清茗
陌清茗 2020-12-15 17:26

I can\'t open or run my .jar file.

I just installed java, but I tried to open the .jar with other programs first, so the double-click defaults to something else and

相关标签:
15条回答
  • 2020-12-15 17:36

    In Netbeans please delete current you create the jar file and on the project explore of Netbeans please clean and build 2 or 3 times and right the project folder in project explore and build the jar file.

    0 讨论(0)
  • 2020-12-15 17:40

    first of all, we have to make sure that you have downloaded and installed the JDK. In order to download it click on the following link

    http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

    (Do not forget to check "Accept License Agreement", before you choose the version you want to download)

    For Windows OS 32-Bit (x86) choose "jdk-8u77-windows-i586.exe"

    For Windows OS 64-Bit (x64) choose "jdk-8u77-windows-x64.exe"

    Install the file that is going to be downloaded. During the installation, pay attention, because you have to keep the installation path.

    When you have done so, the last thing to do, is to define two "Environment Variables".

    The first "Environmental Variable" name should be:

    JAVA_HOME and its value should be the installation path

    (for example: C:\Program Files\Java\jdk1.8.0_77)

    The second "Environmental Variable" name should be:

    JRE_HOME and its value should be the installation path

    (for example C:\Program Files\Java\jre8)

    As soon as you have defined the Environment Variables, you can go to command prompt (cdm) and run from every path your preferred "java.exe" commands. Your command line can now recognize your "java.exe" commands.

    :)

    P.S.: In order to define "Environment Variable", make a right click on "This PC" and select "properties" from the menu. Then the "System" window will appear and you have to click on "Advanced system settings". As a consequence "System properties" window shows. Select the "Advanced" tab and click on "Environment Variables" button. You can now define the aforementioned variables and you're done

    0 讨论(0)
  • 2020-12-15 17:44

    There are two different types of Java to download: The JDK, which is used to write Java programs, and the RE (runtime environment), which is used to actually run Java programs. Are you sure that you installed the RE instead of the SDK?

    0 讨论(0)
  • 2020-12-15 17:46

    you can use the command prompt:

    javaw.exe -jar yourfile.jar
    

    Hope it works for you.

    0 讨论(0)
  • 2020-12-15 17:47

    If the intention of the question is to view the contents of the JAR file, then the following java command would help.. (provided, JDK location is added to the environment variables.)

    Windows Command prompt> jar tvf yourJarFile.jar

    • Example:

      jar tvf log4j-extras-1.2.17.jar

    Reference: http://docs.oracle.com/javase/tutorial/deployment/jar/view.html

    0 讨论(0)
  • 2020-12-15 17:47

    I downloaded the latest JDK 7u10. Once you do that, try running your jar, It should execute.

    0 讨论(0)
提交回复
热议问题