1

C:/user/desktop> java -jar app.jar
Error

Exception in thread "main" java.lang.NoClassDefFoundError: FileChooserDemo (wrong name: components/FileChooserDemo)

Demo code downloaded from here

This file is used to create a jar application.

manifest.mf

Manifest-Version: 1.0
Created-By: 1.7.0_25 (Oracle Corporation)
Main-Class: components.FileChooserDemo
BioDeveloper
  • 618
  • 3
  • 8
  • 25
  • Can you post your MANIFEST.MF? – Teg Aug 19 '13 at 07:00
  • yeah...sure just a second. – BioDeveloper Aug 19 '13 at 07:01
  • Change your manifest to `Main-Class: components.FileChooserDemo` – c.s. Aug 19 '13 at 07:03
  • @c.s. I did and rebuilt, Error: Could not find or load main class components.FileChooserDemo – BioDeveloper Aug 19 '13 at 07:05
  • Is this class inside the jar? Please add details of your folder source structure, how you build and the resulting jar's contents (I also assume `FileChooserDemo` has a `main` method, right?) – c.s. Aug 19 '13 at 07:08
  • @Nari2 : Please have a look at this answer regarding [JFileChooserDemo from Oracle](http://stackoverflow.com/a/17745494/1057230). Hope it helps :-) Moreover, it appears to me, that you forgot to provide a __newline__ at the end of the __manifest__ file. – nIcE cOw Aug 19 '13 at 07:13
  • @nIcEcOw new line is there. – BioDeveloper Aug 19 '13 at 07:25
  • @Nari2 : Have you tried the steps, posted in the link provided by me ? You can create a JAR file by following these [steps](http://stackoverflow.com/a/15187181/1057230) :-) – nIcE cOw Aug 19 '13 at 08:25

1 Answers1

1

Your class path is incorrect. The class file is referenced and found in an incorrect location instead of components/FileChooserDemo as specified in the source. Investigate your jar file.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347