Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » problem using external jar files
problem using external jar files [message #426175] Thu, 18 December 2008 04:10 Go to next message
Simon Chen is currently offline Simon ChenFriend
Messages: 13
Registered: July 2009
Junior Member
Hi all,

I have problem using external jar files. It's very strange that the jar
files have no problem at all in another project not generated by EMF:
basically, they are added as external jars and work just fine.

On the other hand, for my EMF-powered project, I tried to do the same
thing by adding those jar files as external libraries, in my "project" and
"project.edit" and "project.editor". The project can be compiled without a
problem. I launched "project.editor" as an eclipse application and when I
try to instantiate a new object of a class that uses that external jars,
it would show:

java.lang.NoClassDefFoundError:
com/sshtools/j2ssh/transport/HostKeyVerification

For those that are interested, I am trying to use the jars files for
j2ssh, an open source ssh2 component for java.

Thanks.
-Simon
Re: problem using external jar files [message #426187 is a reply to message #426175] Thu, 18 December 2008 14:30 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30896
Registered: July 2009
Senior Member
Simon,

Comments below.

Simon Chen wrote:
> Hi all,
>
> I have problem using external jar files. It's very strange that the
> jar files have no problem at all in another project not generated by
> EMF: basically, they are added as external jars and work just fine.
You've been messing with the project's properties directly?
>
> On the other hand, for my EMF-powered project, I tried to do the same
> thing by adding those jar files as external libraries, in my "project"
> and "project.edit" and "project.editor". The project can be compiled
> without a problem. I launched "project.editor" as an eclipse
> application and when I try to instantiate a new object of a class that
> uses that external jars, it would show:
>
> java.lang.NoClassDefFoundError:
> com/sshtools/j2ssh/transport/HostKeyVerification
>
> For those that are interested, I am trying to use the jars files for
> j2ssh, an open source ssh2 component for java.
You'd find if you used your approach with any other plugin projects
you'd have the same problem. When building Eclipse applications you
should NEVER modify the classpath directly via the project's
properties. You should ALWAYs edit the MANIFEST.MF's dependencies.
That's because the MANIFEST.MF is used to control the classpath both at
development time and runtime, so if you bypass it, you'll fix your
development time problems only to have them come back as runtime.

You need to package your external jar as a bundle so you can create
bundle dependencies on it, or include it in one of your existing bundles
(not such a great approach).
>
> Thanks.
> -Simon
>
Previous Topic:Using Sample Reflective Ecore Model Editor on our XMI files
Next Topic:cdf file export
Goto Forum:
  


Current Time: Sat Feb 22 17:19:13 GMT 2020

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

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

Back to the top