my dog learned polymorphism*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Why Denny's DVD application is not running? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Why Denny Watch "Why Denny New topic
Author

Why Denny's DVD application is not running?

Palraj Jayaraj
Ranch Hand

Joined: Jun 06, 2012
Posts: 34

I made a jar of the project and when I try to type the command "javaw -jar sampleproject.jar alone"
and run it...
it is not working..
kindly help me..
Thanks in advance
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5121
    
  12

Please TellTheDetails

Did you build an executable jar. Which exception do you get?


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Palraj Jayaraj
Ranch Hand

Joined: Jun 06, 2012
Posts: 34

Yes, I made a JAR for the project..
But, when I try to use the command "javaw -jar sampleproject.jar " and run it.
It is running.
By the way, I'm not getting exceptions..

Following is the command prompt status, when I run the command


E:\SCJD\denny's DVD src code\2563>javaw -jar sampleproject.jar alone

E:\SCJD\denny's DVD src code\2563>
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5121
    
  12

Makes it any difference if you use the java command to start the jar?

So you say "it's running" but "it's not working". What's wrong? Which part is not working? It's impossible to help you if you don't provide more information, please TellTheDetails.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Roel also asked if you made an executable jar - not just any jar, but one that you have explicitly told the jar command that the resultant file should be executable.

Perhaps you could show us the command line you used to create the jar file?


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Palraj Jayaraj
Ranch Hand

Joined: Jun 06, 2012
Posts: 34

Sorry for not providing enough information.

Below are the commands I run on the 'CMD'.


"C:\Users\Paul_E>E:

E:\>E:\SCJD\denny's DVD src code\2563
'E:\SCJD\denny's' is not recognized as an internal or external command,
operable program or batch file.

E:\>cd E:\SCJD\denny's DVD src code\2563

E:\SCJD\denny's DVD src code\2563>set path=C:\Program Files\Java\jdk1.7.0_05\bin


E:\SCJD\denny's DVD src code\2563>javac -d classes sampleproject\db\*.java

E:\SCJD\denny's DVD src code\2563>javac -d classes sampleproject\remote\*.java

E:\SCJD\denny's DVD src code\2563>javac -d classes sampleproject\sockets\*.java

E:\SCJD\denny's DVD src code\2563>javac -d classes sampleproject\gui\*.java

E:\SCJD\denny's DVD src code\2563>jar -cfm sampleproject.jar Manifest.mf -C cla
sses .

E:\SCJD\denny's DVD src code\2563>javaw -jar sampleproject.jar alone

E:\SCJD\denny's DVD src code\2563>javaw -jar sampleproject.jar

E:\SCJD\denny's DVD src code\2563>javaw -jar sampleproject.jar server

E:\SCJD\denny's DVD src code\2563>"


Could this help?
Or Am I missing something?
Palraj Jayaraj
Ranch Hand

Joined: Jun 06, 2012
Posts: 34

It would be very helpful, why we use the parameter '-cfm', when we create the '.jar' file?

By the way

"E:\SCJD\denny's DVD src code\2563>javaw -jar sampleproject.jar alone

E:\SCJD\denny's DVD src code\2563>javaw -jar sampleproject.jar

E:\SCJD\denny's DVD src code\2563>javaw -jar sampleproject.jar server "

These 3 commands, produce nothing.

Thanks in advance
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5121
    
  12

Did you create a Manifest.MF file where you set the main class of the application? That's the class containing the main method (which should be executed when the jar is executed).
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5121
    
  12

Palraj Jayaraj wrote:why we use the parameter '-cfm', when we create the '.jar' file?

Have a look at the documentation of the jar tool for more information about these options.
Palraj Jayaraj
Ranch Hand

Joined: Jun 06, 2012
Posts: 34

Yeah, I created the MANIFEST.mf file in the "2563" folder and it's content is:

"Manifest-Version: 1.0
Main-Class: sampleproject.gui.ApplicationRunner"
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

So you have a 2563/MANIFEST.MF file?! It should be META-INF/MANIFEST.MF.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5121
    
  12

Could you describe the structure of your jar file? And also show the content of the manifest.mf file in your jar.
Palraj Jayaraj
Ranch Hand

Joined: Jun 06, 2012
Posts: 34

I too have a "MANIFEST.mf"under that "meta-inf" folder.

it's content:

"Manifest-Version: 1.0
Created-By: 1.7.0_05 (Oracle Corporation)
Main-Class: sampleproject.gui.ApplicationRunner"
Palraj Jayaraj
Ranch Hand

Joined: Jun 06, 2012
Posts: 34

@Roel:" sorry, I don't understand..
Structure in the sense?

the content of the Manifest.mf file in the jar is
<i>"Manifest-Version: 1.0
Created-By: 1.7.0_05 (Oracle Corporation)</i>
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5121
    
  12

Which directories do you have in your jar.

Palraj Jayaraj wrote:the content of the Manifest.mf file in the jar is
"Manifest-Version: 1.0
Created-By: 1.7.0_05 (Oracle Corporation)

That explains why nothing is happening: you don't have a Main-Class entry, so java doesn't know which class it has to start from the jar
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5121
    
  12

Here you find valuable information about creating the jar with the manifest.mf file and possible pitfalls where you have to be careful with.
Palraj Jayaraj
Ranch Hand

Joined: Jun 06, 2012
Posts: 34

Thanks Roel and Andrew,
the problem with the Manifest.mf file is that I forgot tp press enter after I typed in that file

Now, I'm able to run it
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5121
    
  12

Glad to hear you were able to solve it!
 
Consider Paul's rocket mass heater.
 
subject: Why Denny's DVD application is not running?
 
Similar Threads
packaging final application
which file type contains all required stuff the can execute Java Programs
how can we make a jar file
WA #1.....word association
Hibernate Problem