• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in thread "main" java.lang.NoClassDefFoundError  RSS feed

 
Kee Kee moon
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have jar file that contains the class com.sun.media.jai.codec.SeekableStream, but I still get a compiling error as below:

Exception in thread "main" java.lang.NoClassDefFoundError: com.sun.media.jai.codec.SeekableStream
I have been googling, but could not find a solution.

please help.
Thanks
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This means you're missing a necessary JAR file in the classpath.

That class is part of the Java Advanced Imaging (JAI) API. You'll have to find out which JAR file(s) you need to use that API and make sure they are in classpath when you compile and run your program.
 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it safe to use a package beginning com.sun?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Is it safe to use a package beginning com.sun?

You should not use 'sun' or 'com.sun' packages that are inside the JDK; those are not part of the public API of the JDK, and using them makes your program possibly incompatible with future versions of Java.

But here it's about JAI, an external library that's not part of the JDK, and the package com.sun.media.jai.codec is part of the public API of this library, so in this case it's no problem to use classes in this package.
 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote: . . . You should not use 'sun' or 'com.sun' packages that are inside the JDK; . . . But here it's about JAI, an external library that's not part of the JDK, . . .
Thank you. I wasn’t sure, and I thought it best to check that this isn’t the cause of the problem.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!