Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Problems running standalone SWT program from JAR file
Problems running standalone SWT program from JAR file [message #461773] Thu, 29 September 2005 18:19
Eclipse UserFriend
Originally posted by: eclipse.ptoye.com

Another silly newbie question, this time about how to build a JAR file for
a standalone SWT prog.

I tried using the File|Export wizard, included org.eclipse.swt as a
resource and told it to generate a manifest. It generated OK (with a
complaint that .classpath and .project were duplicated) but when I run it
from a command line I get

>java -jar PartSWT.jar
Exception in thread "main" java.lang.NoClassDefFoundError:
org/eclipse/swt/events/SelectionListener
at java.lang.ClassLoader.defineClass1(Native Method)
.
.
.

I suspect that the problem is in the manifest, but AFAICS the help files
don't tell you what to put in there (just the syntax) and the books I've
got are too elementary to be of use.

There are really two questions:

1) What should I change manually to get it to work?

2) Is it an Eclipse bug that the automatic generation doesn't work?

The manifest and jardesc files follow.

Peter

The MANIFEST.MF file in the JAR file says:

Manifest-Version: 1.0
Class-Path: swt.jar
Main-Class: com.ptoye.partSWT.GeneratePartitions

The JAR description file says:

<?xml version="1.0" encoding="UTF-8"?>
<jardesc>
<jar path="D:/Peter/Java/PartitionSWT/PartSWT.jar"/>
<options buildIfNeeded="true" compress="true"
descriptionLocation="/PartitionSWT/PartSWT.jardesc" exportErrors="true"
exportWarnings="true" includeDirectoryEntries="false" overwrite="false"
saveDescription="true" useSourceFolders="false"/>
<manifest generateManifest="false"
mainClassHandleIdentifier="=PartitionSWT/&lt;com.ptoye.partSWT
{GeneratePartitions.java[GeneratePartitions"
manifestLocation="/PartitionSWT/PartSWT.mf" manifestVersion="1.0"
reuseManifest="true" saveManifest="true" usesManifest="true">
<sealing sealJar="false">
<packagesToSeal/>
<packagesToUnSeal/>
</sealing>
</manifest>
<selectedElements exportClassFiles="true" exportJavaFiles="false"
exportOutputFolder="false">
<javaElement handleIdentifier="=org.eclipse.swt"/>
<javaElement handleIdentifier="=PartitionSWT/&lt;com.ptoye.partSWT"/ >
</selectedElements>
</jardesc>
Previous Topic:ModalContext.run error
Next Topic:HTML Editor
Goto Forum:
  


Current Time: Sat Jul 05 09:05:28 EDT 2025

Powered by FUDForum. Page generated in 0.03851 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top