1. Dashboard
  2. Forum
    1. Unerledigte Themen
  3. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team-Mitglieder
    4. Trophäen
    5. Mitgliedersuche
  4. Tutorial Bereich
  • Anmelden
  • Registrieren
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Seiten
  • Forum
  • Lexikon
  • 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
  • Iron Leash
    5
    Iron Leash
    Mitglied
    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
    8
    Zaru
    Mitglied
    Reaktionen
    12
    Punkte
    592
    Beiträge
    116
    • 23. Oktober 2010 um 22:53
    • #2

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

  • maciej
    3
    maciej
    Mitglied
    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
    8
    Zaru
    Mitglied
    Reaktionen
    12
    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
    5
    Iron Leash
    Mitglied
    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
    5
    Iron Leash
    Mitglied
    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
    13
    sutupud
    Mitglied
    Reaktionen
    59
    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.

    "All through my life I've had this strange unaccountable feeling that something was going on in the world, something big, even sinister, and no one would tell me what it was."
    "No," said the old man, "that's just perfectly normal paranoia. Everyone in the Universe has that."

    😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏😐😒😓😔😖😘😚😜😞😠😡😢😣😥😨😩😪😫😭😰😱😲😳😵😶😷

  • Maximilian Rupp 27. Dezember 2024 um 00:26

    Hat das Thema aus dem Forum Programmieren nach Entwicklung verschoben.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!

Benutzerkonto erstellen Anmelden

Rechtliches

Impressum

Datenschutzerklärung