Ok, I am trying to build a jar file and I cannot seem to find my way around. I have attached an image to this thread to show my directory structure.

Now, I am navigating to my MultiProjectManagement directory and creating my manifest.txt file with:

echo Main-Class: multi.project.management.panels.ProjectListPanel > manifest.txt

Then, I am doing this:
jar -cvfm MPManagement.jar manifest.txt bin multiProjectManagement lib

The jar file is being generated, but when I java -jar MPManagement.jar, I get an error saying:
could not find or load main class: multi.project.management.panels.ProjectListPanel

I understand that my main class is inside bin directory. Now, from what I found online, I hoped that navigating to bin and putting my database, that is multiProjectManagement, and lib folders in bin, and generating the jar file as above would solve the issue, but in that case I am getting a null pointer exception as my program can't find EmbeddedDriver class from derby.jar.

Can someone please guide my how I can create my jar file and make sure it finds my main class, or my EmbeddedDriver class from derby. 0f9c21b88c403301c00e1b0f748fd4ac

Recommended Answers

All 4 Replies

Member Avatar

Why not just use the IDE to build the jar file. I had a similar issue ages ago and found using the IDE was much simpler.

I have never used the IDE for this and it slipped my mind that it even is possible.

Member Avatar

Yup it's possible and recommended especially if you have many files, embedded drivers etc.

Mastering the command line is always a good idea for simple tasks, maybe compiling and creating simple jar (swing) files.

yeah, thanks iamthwee. I have created jar files before, and it was quite straight forward. but this one puzzled me. I guess I'll try eclipse's utility for jar generation. thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.