I'm making a software using SWT. I have exported it from eclipse to a JAR file using a custom Manifest file:
Manifest-Version: 1.0
Class-Path: swt.jar
Main-Class: db_hud.HUD_Maker
My Navigation menu looks something like this
Java Project
- bin
- src
+ db_hd
> HUD_Maker.java
> Classes.java
- Logfile.txt
- Manifest.txt
- swt.jar
- .classpath
- .project
org.eclipse.swt
-All the stuff for SWT (jar, .classpath, etc.)
I have the swt.jar in my classpath with kind lib. I tried changing the Main-Class in the manifest file to include .java in the end, it said "Main Class not found" I do not know how to reproduce this error since I don't know what is the cause of it. If I did I would not be looking for a solution to this problem.
I have tried exporting it as a JAR with the manifest file, but what I get in the console is:
Exception in thread "main" java.lang.NoClassDefFoundError:
if i just double click i get a JNI Error. No idea what that is...
Can anyone help me? or is this info too little?
Export your java code to a jar file eg hudmaker.jar then put your jar and the swt.jar in a directory. The swt.jar library can be downloaded from eclipse [1]. Open a command line and change to that directory.
Then start your code like this
java.exe -Djava.library.path="." -cp "hudmaker.jar;swt.jar" db_hud.HUD_Maker
As an alternative you can create an executable jar [2].
[1] https://www.eclipse.org/swt/
[2] http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-37.htm
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.