1. Weiterleitung zu NetzLiving.de
  2. Forum
    1. Unerledigte Themen
  3. zum neuen Forum
  • Anmelden
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Seiten
  • Forum
  • Erweiterte Suche
  1. Informatik Forum
  2. Webmaster & Internet
  3. Entwicklung

the java jar file could not be executed

  • Iron Leash
  • 23. Oktober 2010 um 22:23
  • Unerledigt
Hallo zusammen,

das Informatik-Forum geht in den Archivmodus, genaue Informationen kann man der entsprechenden Ankündigung entnehmen. Als Dankeschön für die Treue bekommt man von uns einen Gutscheincode (informatikforum30) womit man bei netzliving.de 30% auf das erste Jahr sparen kann. (Genaue Infos sind ebenfalls in der Ankündigung)

Vielen Dank für die Treue und das Verständnis!
  • Iron Leash
    Punkte
    180
    Beiträge
    24
    • 23. Oktober 2010 um 22:23
    • #1

    Ich ertelle eine .jar datei die bei netbeans ganz normal funktioniert aber nicht über terminal.
    ich kriege die fehlermeldung the java jar file could not be executed wenn ich auf die -jar datei klicke.
    wenn ich sie mit java -jar bsp1.jar durführe kriege ich diefehlermeldung

    Exception in thread "main" java.lang.NoClassDefFoundError: bsp/Main
    Caused by: java.lang.ClassNotFoundException: bsp.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

    weiss jemand wo das problem liegen kann?
    ich danke im voraus
    lg
    ilker

  • Zaru
    Punkte
    592
    Beiträge
    116
    • 23. Oktober 2010 um 22:53
    • #2

    Was ist denn überhaupt alles in der jar File drin?

  • maciej
    Punkte
    50
    Beiträge
    10
    • 23. Oktober 2010 um 22:54
    • #3

    kannst du mal das manifest file posten und die filestruktur im jar file?

  • Zaru
    Punkte
    592
    Beiträge
    116
    • 23. Oktober 2010 um 22:58
    • #4

    Kann sein dass du das schon weißt und das Problem ganz was anderes ist, aber

    Zitat

    Before this command will work, however, the runtime environment needs to know which class within the JAR file is the application's entry point.
    To indicate which class is the application's entry point, you must add a Main-Class header to the JAR file's manifest. The header takes the form:
    Main-Class: classname
    The header's value, classname, is the name of the class that's the application's entry point.
    To create a JAR file having a manifest with the appropriate Main-Class header, you can use the Jar tool's m flag as described in the Modifying a Manifest section. You would first prepare a text file consisting of single line with the Main-Class header and value. For example, if your application was the single-class HelloWorld application, the entry point would of course be the HelloWorld class, and your text file would have this line:
    Main-Class: HelloWorld
    Assuming your text file was in a file called mainClass, you could merge it into a JAR file's manifest with a command such as this:
    jar cmf mainClass app.jar HelloWorld.class
    With your JAR file prepared in this way, you can run the HelloWorld application from the command line:
    java -jar app.jar

    Alles anzeigen
  • Iron Leash
    Punkte
    180
    Beiträge
    24
    • 23. Oktober 2010 um 23:02
    • #5

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.8.1
    Created-By: 1.6.0_22-b04-307-10M3261 (Apple Inc.)
    Main-Class: gizem.Main
    Class-Path:
    X-COMMENT: Main-Class will be added automatically by build


    und ich habe insgesamt 6 + 6 12 dateien namens Bsp1.java bzw .class bis Bsp6

  • Iron Leash
    Punkte
    180
    Beiträge
    24
    • 23. Oktober 2010 um 23:10
    • #6

    Ich habe die Main klasse verändert ein mal clean and build und nun funktioniert es.
    Das problem ist dass dieses problem auch für ein paar andere .jar dateien deren konfiguration nicht mehr veränderbar ist....

  • sutupud
    Punkte
    1.659
    Beiträge
    320
    • 24. Oktober 2010 um 00:40
    • #7
    Zitat von Iron Leash

    ... andere .jar dateien deren konfiguration nicht mehr veränderbar ist....

    wieso nicht? entzippen, manifest verändern, wieder zippen - wüsste keinen grund warum das nicht gehen sollte.

  • Maximilian Rupp 27. Dezember 2024 um 00:26

    Hat das Thema aus dem Forum Programmieren nach Entwicklung verschoben.

  1. Datenschutzerklärung
  2. Impressum