This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes jar file opens the main class but not the other classes.... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "jar file opens the main class but not the other classes...." Watch "jar file opens the main class but not the other classes...." New topic
Author

jar file opens the main class but not the other classes....

Bhagyashri Dalave
Greenhorn

Joined: Dec 05, 2012
Posts: 4
hieee...
i have created a java application for an enquiry management system...
but when i creates a jar file it opens by double click also but the problem is it only opens the main class menu that i have specified as a main class in manifest.txt but when i clicks on any menu it is not able to load the other classes.... i am calling another class by 'new classname()'....
please help me...
any help would be appreciated...
Thanks in advance...
Swastik Dey
Ranch Hand

Joined: Jan 08, 2009
Posts: 1188

Bhagyashri,

What error is it showing? Have you included all the required files while crating the jar.


Swastik
Bhagyashri Dalave
Greenhorn

Joined: Dec 05, 2012
Posts: 4
hi swastik....
i am not getting any error...
if i runs the same jar file using command prompt java -jar menu.jar then works but it i runs it by double click it just loads the main class and not the other classes...
Thanks
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 361
I deleted my response - I misunderstood.
Vinod Tiwari
Ranch Hand

Joined: Feb 06, 2008
Posts: 458
I think you need to initialize / call other class from the class which you have mentioned in Manifest file.


Vinod Tiwari | Twitter
Bhagyashri Dalave
Greenhorn

Joined: Dec 05, 2012
Posts: 4
Hi vinod
Yes i am calling other classes from the main class that i have specified in manifest file...
by using new class()
but the strange thing is when i runs jar by double clicking it... it runs but when i clicks on menu one class opens but not the other classes...
Thanks
Bhagyashri Dalave
Greenhorn

Joined: Dec 05, 2012
Posts: 4
if you opens reports->followup->periodic followup then it opens...
but if you try to open other classes then it will not open...
i am really stuck here...
not getting what is the problem...
Thanks
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 1262
    
    7

Bhagyashri,

the most important tool that you have in your toolbox as a Java developer is stack traces. So, make sure that when you catch an exception, you log it. Wither do e.printStackTrace or if you use a logger, use the logger API to log the exception. That should point you in the right direction for 60% of your problems

The next important tool is either debugger or logging messages. When something is not working, you can debug through the code and make it go step by step to check if the code is following the path that you expect. When it doesn't you can inspect your variables to figure out why it doesn't follow the path that you want it to follow. SOme people don;t like debugger and do this by putting log messages all over the code

Just saying "trying to open class" doesn't help anyone. That's like calling your mechanic and telling them, "my car doesn't start"*. It's completely useless. You need to go under the hood

*[complete hijack]
SOmeone I knew who is a damn good programmer herself did this with a mechanic. SHe had a problem with the ignition on her car. She called me for help, and I couldn't figure it out, so I told her to call a mechanic. She calls the mechanic and the first thing she says is "my car doesn't start". I was sitting there shaking my head. The first thing the mechanic said "Do you have gas/petrol?"
[/complete hijack]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel
 
subject: jar file opens the main class but not the other classes....
 
Similar Threads
Boggled by Eclipse - help!
Setting up a Java project in eclipse
implementation and interfaces in seperate jar files
Problem with the path inside a jar-file
Creating a Jar (NON executable) with all the dependencies