Eclipse: SWT Projekt in JAR packen

Status
Nicht offen für weitere Antworten.
F

FlorianK

Gast
Hallo,

ich habe ein SWT-Projekt geschrieben.
Nun möchte ich mein Programm in eine ausführbare JAR-Datei schreiben.
Jedoch funktioniert das nicht reibungslos :/

Ich arbeite mit Eclispe 3.2...
Ich gehe auf "Export" und wähle "JAR-Datei" aus
Im nächsten Schritt wähle ich mein Projekt aus und geb der JAR-Datei einen Namen
Beim nächsten Schritt ändere ich nichts.
Beim letzten Schritt gebe ich den Ort meiner Main-Methode an und klick auf Finish.

Anschließend bekomm ich folgenden Fehler zurück:
Code:
JAR creation failed. See details for additional information.

Code:
Export with compile warnings: [JAVA-Datei]
Export with compile warnings: [JAVA-Datei]
Class file(s) on classpath not found or not accessible [JAVA-Datei]
Export with compile warnings: [JAVA-Datei]
Export with compile warnings: [JAVA-Datei]
Problem writing .classpath to JAR: duplicate entry: .classpath
duplicate entry: .classpath
..... usw.
 
F

FlorianK

Gast
Was ich noch vergessen hatte:

Ich habe noch eine weitere JAR-Datei (jdom.jar) in mein Projekt eingebunden.
Ich habe gelesen, dass es damit Probleme geben kann.
Stimmt das?
 

byte

Top Contributor
Du musst Dein Projekt ganz normal in ein Jar exportieren und danach noch den Classpath anpassen. Je nachdem welche SWT-Klassen Du verwendest, benötigst Du noch diverse Jars aus dem Eclipse Plugin Verzeichnis. Im Minimalfall die plattformspezifische swt.jar (also z.B. win32). Darüber hinaus brauchst Du dann noch die nativen Bibliotheken, also für Windows die verschiedenen DLLs.

Du kannst Dir z.B. SWT von www.eclipse.org/swt/ nochmal separat runterladen. Da sind die swt.jar und die DLLs dabei. Dann kannst Du Dir z.B. für den Aufruf Deiner Anwendung eine Batch-Datei schreiben für den Java-Aufruf:

java -cp swt.jar;jdom.jar;... -Djava.library.path=pfad_zu_den_DLLs -jar DeinJar.jar
 
F

FlorianK

Gast
Vielen Dank für die schnelle Antwort!

Ich habe mir nun eine Batch-Datei geschrieben:
Code:
java -cp swt.jar;jdom.jar -Djava.library.path=dlls -jar gvaudit.jar

So liegen meine Dateien
  • GVAudit
    [list:5e391530ec]dlls
    [list:5e391530ec]swt-awt-win32-3235.dll
    swt-gdip-win32-3235.dll
    swt-wgl-win32-3235.dll
    swt-win32-3235.dll
org.eclipse.swt.win32.win32.x86_3.2.1.v3235.jar
jdom.jar
gvaudit.jar
gvaudit.bat[/list:u:5e391530ec][/list:u:5e391530ec]

Bekomme aber nun folgenden Fehler:
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom/Content
 

byte

Top Contributor
Versuchs so:

java -cp org.eclipse.swt.win32.win32.x86_3.2.1.v3235.jar;jdom.jar -Djava.library.path=dlls -jar gvaudit.jar


Im Manifest Deines Jars muss auch die Main-Klasse richtig angegeben sein. Und je nachdem, was Du alles verwendest vom SWT-Framework, kanns sein, dass Du noch weitere Jars benötigst.
 
F

FlorianK

Gast
Ich habe die Batch-Datei geändern, gleicher Fehler...

In meiner MANIFEST.MF steht folgendes drin:
Code:
Manifest-Version: 1.0
Main-Class: gvaudit.GVAudit
Was auch soweit stimmt, da dass die Datei ist, wo meine Main-Methode drin liegt.

In meinem Projekt include ich folgendes (in unterschiedlichen Dateien):
Code:
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
Benötige ich weitere JARs?
Oder sind sie in der SWT.jar enthalten?

Bzw, muss ich die saxpath.jar o.ä. JARs auch angeben?
Oder sind die mit der jdom.jar abgedeckt?
 

byte

Top Contributor
Keine Ahnung was saxpath.jar ist, aber wenn Du es verwendest, musst Du es natürlich auch angeben.

Verwendest Du vielleicht noch einen anderen als den Standard JAXP Parser zum einlesen der XML-Daten, also z.B. Xerces? Wenn ja, dann muss der natürlich auch in den Classpath.

Du musst alle externen Jars angeben, die nicht zum JRE gehören.
 

SnooP

Top Contributor
kleiner Tipp - guck dir die jars an und welche Klassen da drin sind... - dann einzeln hinzufügen, bis die Fehlermeldungen halt weggehen ;) ... kann schonmal länger dauern, wenn man nicht immer weiß, wo was alles enthalten ist.
 
Status
Nicht offen für weitere Antworten.
Ähnliche Java Themen
  Titel Forum Antworten Datum
T Eclipse Java Projekt funktioniert in Eclipse, aber nach export kein Dateizugriff IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
A Eclipse Projekt-Umzug mit Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 8
T GlassFish mit Eclipse, Dynamic Web Projekt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
N Eclipse debug Gradle-Projekt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
M Eclipse - Fehlermeldung bei JavaFX-Projekt "java.lang.module.FindException: Module javafx.controls not found" IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 23
T Eclipse: Projekt aus meinem Workspace als Library auswählen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
M Eclipse JavaFX JDK 12 - bekomme mein Projekt nicht mehr compiliert IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 36
H Eclipse Konsole gibt falsches Java Projekt aus IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
L Eclipse Eclipse - Projekte "mischen" Dynamisches Web Projekt + Maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
A Eclipse/Android: Projekt -> .apk IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
M Eclipse Projekt zu GitHub Repository hinzufügen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
Maxim6394 Eclipse zeigt Fehler in Projekt und kompiliert nicht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
H Eclipse + ADK installation - Kein Android Projekt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
S Eclipse: JUnit bei jedem Projekt automatisch hinzufügen lassen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
D Eclipse Eclipse Fehler im Projekt (nicht im Source) IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
H Projekt-Einstellungen von Eclipse mit subversion verwalten IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
Gregorrr Eclipse Best Practice: Multi-Projekt mit Eclipse + EGit (Git) + m2e (Maven) IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
D Eclipse Projekt exportieren , aber bestimmte Verzeichnisse auslassen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 14
J Eclipse Checkout/Import Maven Projekt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
F Projekt ist weg (Eclipse -> ICQ) IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 10
D Eclipse Wie ein NetBeans-Projekt automatisch in Eclipse importieren? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
ruutaiokwu eclipse zeigt nur noch das eine projekt an... IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
N Eclipse bestehendes Projekt in Eclipse einfügen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
G Eclipse Projekt Set IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
FoolMoon Eclipse Projekt mit PW versehen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
T Eclipse - Einbinden von dlls in Projekt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
L Eclipse-Projekt aus SVN so auschecken, daß Junit funktioniert IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
T Eclipse+SVN, J2EE-Projekt, Checkout IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 17
S Netbeans Projekt nach Eclipse migrieren IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
B komplettes projekt in eclipse wieder öffnen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 11
G Eclipse - Projekt verschieben IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
D Projekt ohne Komplikationen in Eclipse importieren IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
O Suche ne Eclipse Version für ein Java Web Projekt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
G Neues Seam Projekt mit Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
C Java-Projekt in Eclipse importieren/exportieren IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
B Eclipse - Projekt von Windows nach Linux IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
J Eclipse WTP: Web Projekt - mysql einbindung nicht moeglich IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
R Eclipse: wie Bilder zum Projekt hinzufügen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 13
J Eclipse: Jar Library -> Web Projekt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
G Eclipse-Projekt, inkl. externe jars und Bilderordner zu jar? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
E Eclipse 3.3 JEE- kann kein J2EE Projekt erstellen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
M Eclipse: JAR-Archive vom Projekt erzeugen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
J Spring in Eclipse-Projekt einbinden IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
L Eclipse Projekt gelöscht (auch physikalisch) - recovery? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 10
E Eclipse: Dateien zu Projekt hinzufügen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
M wie beliebige Wörter im gesamten Eclipse-Projekt suchen ? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
A Eclipse: dll in Projekt nutzen? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
S eclipse Projekt read-only IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
R Eclipse beim Ausführen zur Eingabe in die Konsole springen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
M Eclipse oder IntelliJ? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 8
JonasM Gibt es eine Libary in Eclipse mit der ich Daten per USB an einen Microkontroller Senden kann? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
N Erstellen einer ausführbaren jar Datei in Eclipse (Linux Mint) IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 17
O Eclipse stürzt beim Autovervollständigen ab IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 17
C In Eclipse Einrückung im Java-Editor einstellen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
Avalon html ist nicht html in eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
A Docker im Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
Robertop Eclipse resolved Target-Platform nicht wegen automatischem HTTPS IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
C Eclipse englisch, deutsche Kommentare leider rot unterkringelt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
T Eclipse von Java 1.8 auf 17 IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
S [Eclipse] Zwei verschiedene Konfigurationen erstellen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
D Eclipse Eclipse und OpenGL IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
M Ausführbares Programm aus Eclipse exportieren IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
Java00User00 Eclipse Theme IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
F Eclipse für Java 1.8 ARM einrichten IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
D Crawler funktioniert in intellij aber in Eclipse nicht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
U Problem mit Eclipse - WindowBuilder - memoryLeak? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 15
F Eclipse - Änderung am Code ohne Applikation Neustart IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
E Hilfe mit Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
B Eclipse version control System das ohne Internet funktioniert/nur lokal auf Computer? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
B Eclipse Problem mit jar Datei? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
N Eclipse erzeugt plötzlich keine (default package) mehr IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 24
F alle Eclipse Projekte auf git hochladen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
O Java Eclipse Umlaute werden nicht richtig dargestellt in Konsole IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 10
B .exe Datei für Eclipse Java Programm erstellen? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
Eclipse Build path duplication entry IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 11
B Wie nicht-java Datei mit Eclipse benutzen (Excel Datei einlesen)? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 16
nbergmann Eclipse Eclipse-Concole: Ergebnis-Zahlenfolge erscheint kurz und verschwindet dann wieder IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 21
berserkerdq2 Eclipse Eclipse führt nicht dei Klasse aus, bei der ich bin, muss das immer manuell ändern, was tun? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
MiHimbert Eclipse + Wildfly26 + primefaces11 + openjdk18 IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 22
S Eclipse Umlaute IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 13
S Fehlermeldung bei Nutzung Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
LimDul IDEA IntelliJ Tipps für den Umstieg von Eclipse auf intelliJ IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
Robertop Maven Warnung "'version' contains an expression but should be a constant" in Eclipse verstecken IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
J Eclipse - kein Server verfügbar zum ausführen meines Java Projektes IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 12
P PHP Skript wird nicht mit highlights markiert(Eclipse) IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
B Eclipse Autovervollständigung zeigt nicht alle Methoden einer Klasse an IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
P Eclipse- Zip Datei als Prgramm IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
T Eclipse scheint awt Libary nicht zu besitzen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
G eclipse mit neuestem JDK einrichten IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
P Cucumber Plugin Installation . Eclipse Warnmeldung IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
J Eclipse CDT Library einbinden IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
J Javac File generieren Eclipse oder IntellJ (JNI) IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
sham5 Eclipse-Remote-Debugging von Java mit mehreren Prozessen oder Ports oder Netzen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
Eichi1979 Eclipse Fehler in Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 10
Arita wie kann man die automatische erstellte Ordner von Eclipse in D Drive ziehen? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
nonickatall paho.client.mqttv3 in Eclipse installieren/einbinden IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 8
A Einbindung von FXML-Dateien in Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
A JavaFX in Eclipse einbinden IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 22
nonickatall Remote Debugging Eclipse/Raspberry IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 12
H Outline Fenster (Gliederung) wird mit deutschem Sprachpaket nicht angezeigt, Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2

Ähnliche Java Themen

Neue Themen


Oben