Skip to main content



      Home
Home » Newcomers » Newcomers » Exported JARs & classpaths
Exported JARs & classpaths [message #60746] Mon, 02 May 2005 08:26 Go to next message
Eclipse UserFriend
Originally posted by: chris_usenet.lykaon.noeggbaconsausageandspam.org.uk

Hi,

Up to now I've used Eclipse pretty basically and all my
exported JARs (via the File->Export wizard) work wonderfully.

Using WinXP SP2 & Eclipse 3.1.0 BuildID 200412162000

I wanted an app to speak to one of my COM ports so I installed
javacomm20 from Sun. A quick in place test (compile & run in a
DOS shell) of the sample code showed the install was OK and
my CLASSPATH vars are set up OK.
Setting Project->Properties->Java Build Path->Libraries and
adding comm.jar enabled Eclipse to recognise all the javacomm
elements (no red underline) and I could run my code happily
(context menu ->Run As->Java Application and I could pull data
from my GPS reciever.

Exporting as a JAR file, I run through the steps in the wizard

1) tick GPSReader (only class available)
2) tick Export generated calssfiles and resources
3) give name (gpsread.jar) and location of JAR
4) No packaging opts ticked
5) Generate manifest radio set (default)
6) select entry point
7) finish

Same as when I do other JARs

Running the jar (java -jar gpsread.jar) I get

Exception in thread "main" java.lang.NoClassDefFoundError:
javax/comm/UnsupportedCommOperationException

probably because it can't find comm.jar

If I unpack the JAR I can run GPSRead.class happily as it
is using the CLASSPATH from env and not from the manifest.
In the JAR is a file .classpath that contains an XML
description of where the comm.jar is.
In the META_INF dir the MANIFEST.MF is just:

Manifest-Version: 1.0
Main-Class: GPSReader

I was under the impression that the manifest had to contain the
classpath. What is the purpose of the .classpath file?

And now the 64k question. How do I get the JAR to run and
find the comm.jar which Eclipse can find in the IDE environment
but seems to forget when doing the Export?

TIA

Chris
Re: Exported JARs & classpaths [message #60749 is a reply to message #60746] Mon, 02 May 2005 10:46 Go to previous message
Eclipse UserFriend
Originally posted by: chris_usenet.lykaon.noeggbaconsausageandspam.org.uk

On Mon, 2 May 2005 13:26:20 +0100, Chris Lamb wrote:

<snip>

It appears that if you put comm.jar in <JDK>/jre/lib/ext then
all works fine. My problem was that I had set my CLASSPATH in
env vars so it was masking the true cause of the problem, so
making me think it was an Eclipse packaging issue rather than
a Sun javacomm documentation issue.

thanks

Chris
Previous Topic:Q: Typing in Eclipse
Next Topic:Still Can't Run SWT App
Goto Forum:
  


Current Time: Wed Apr 30 14:45:26 EDT 2025

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

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

Back to the top