English 中文(简体)
网络建设项目JAR在清理和建设之后不会运行吗?
原标题:NetBeans project JAR won t run after clean and build?

Inside one of my Netbeans projects, as jar is built and run perfectly. However, when the same project is cleaned & built, the lib folder is absent from dist and the generated jar does not run and produces the following CMD prompt message:

    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

    C:Windowssystem32>CD C:UsersgurukripaDocumentsNetBeansProjectsI-ROOMdist


    C:UsersgurukripaDocumentsNetBeansProjectsI-ROOMdist>java -jar iroom.jAR
    Unable to access jarfile iroom.jAR

    C:UsersgurukripaDocumentsNetBeansProjectsI-ROOMdist>java -jar I-ROOM.jar
    Exception in thread "main" java.lang.UnsupportedClassVersionError: i/room/Essent
    ials (Unsupported major.minor version 51.0)
            at java.lang.ClassLoader.defineClass0(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    3)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
            at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

    C:UsersgurukripaDocumentsNetBeansProjectsI-ROOMdist>

我用的是:

  • Netbeans 7.0,
  • JDK 1.7.0_02,
  • JRE 7
  • Windows 7 32-bit Home Premium

当我双击罐子时没有发生任何情况, 但我可以看到任务管理器正在运行 < code>javaaw 。 是否有合理的理由?

问题回答

您的 JAR 编译的 JDK 版本与您试图运行的版本不同。 确保 Netbeans 和 命令行都使用 JDK 的相同版本 。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签