This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes problems executing executable jar file by double clicking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problems executing executable jar file by double clicking" Watch "problems executing executable jar file by double clicking" New topic
Author

problems executing executable jar file by double clicking

varnita gupte
Greenhorn

Joined: Aug 06, 2009
Posts: 12
Hello,

I have jdk1.6 installed on my m/c.
I have all the required path and classpaths set.
Initially i was able to execute the executable jar file of ArgoUML by double clicking, but now after formating my m/c.
The executable jar file of ArgoUML is not working,it says Main class not found.

But if i run the jar from the command prompt it works.

I have also made the entries in the file types of the folder options for the jar files.

My OS is : Windows XP

Help would be appreciated.

Varnita
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10489
    
    9

Varnita,
Welcome to the Ranch.

You got an interesting problem here. Command line execution works but double click wont.
Can you please tell us how you are invoking the command line?

Since this is more of a general question, I will move it to a more appropriate forum for you.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
varnita gupte
Greenhorn

Joined: Aug 06, 2009
Posts: 12
Hello,

this is what i type at he command prompt.

java -jar argouml.jar



Varnita
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10489
    
    9

Ok.
Can you provide a screenshot of the error dialog which you get when you double click?

To attach the screenshot, you got two options. Host is somewhere on the net and use the Img tag.
OR use the Attachment button at the bottom of the reply dialog.
Ramses Butarbutar
Ranch Hand

Joined: Jun 16, 2009
Posts: 52
Hi varnita gupte,

If you double clicking and response failed, seems you don't have main class manifest attribute
on that jar (executable class) but you say in command prompt work.. so strange..
Hmm... maybe that argouml.jar need other jar to run and it define in your classpath so it work on command prompt..


At the center of non-violence stands the principle of love
.... Martin Luther King, Jr.
varnita gupte
Greenhorn

Joined: Aug 06, 2009
Posts: 12
Hello,

I cannot attach the screenshot, as it is not allowed to send attachment as a rule in our office.

Although i can tell what error is flashed.
Its a msg thrown by the Java virtual machine launcher,
it reads:
Could not find Main class. Program will exit.

Varnita
varnita gupte
Greenhorn

Joined: Aug 06, 2009
Posts: 12
Hello Ramses,

I have used the same jar file many a times for creating class diagrams and sequence diagrams.


Varnita.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10489
    
    9

What is the jar file supposed to do? Is it supposed to popup a UI? Or is it just a library?
Provide us some more information on what it does not do in your opinion, when you say it doesn't work. What is that you expect it to do when you double click.
Ramses Butarbutar
Ranch Hand

Joined: Jun 16, 2009
Posts: 52
varnita gupte wrote:Hello Ramses,

I have used the same jar file many a times for creating class diagrams and sequence diagrams.

Varnita.


Varnita,

I think the problem is not your jar file but your machine. Previously do you install that argoUML by windows installer or binary distribution? If you use binary distribution, after formatting you m/c , do you still have same ArgoUML installation directory as previous? Is there any configuration file in argoUML directory pointing your machine JVM?
varnita gupte
Greenhorn

Joined: Aug 06, 2009
Posts: 12
Hello,

It did not have any windows installer for ArgoUML, i had simply copied the folder structure of that UML tool, and it worked.
And the same folder structure is available now also, so it should work by dbl clicking.

It is supposed to open a GUI on dbl clicking.


Varnita.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10489
    
    9

Can you post the contents of the manifest file?
varnita gupte
Greenhorn

Joined: Aug 06, 2009
Posts: 12
Hello,

The manifest file is long.

Contents are :

Manifest-Version: 2.0
Class-Path: argouml-model.jar ocl-argo.jar gef.jar antlrall.jar log4j.
jar toolbar.jar swidgets.jar commons-logging.jar ext/argouml-i18n-de.
jar ext/argouml-i18n-en_GB.jar ext/argouml-i18n-es.jar ext/argouml-i1
8n-fr.jar ext/argouml-i18n-it.jar ext/argouml-i18n-nb.jar ext/argouml
-i18n-pt.jar ext/argouml-i18n-ru.jar ext/argouml-i18n-sv.jar ext/argo
uml-i18n-zh.jar argouml-mdr.jar java-interfaces.jar jmi.jar jmiutils.
jar mdrapi.jar mof.jar nbmdr.jar openide-util.jar ext/dev.jar
Created-By: 1.2 (Sun Microsystems Inc.)
Ant-Version: Apache Ant 1.6.2
Main-Class: org.argouml.application.Main


The file is long, and contained some abbrevations which are not permissible on the ranch, so could not copy the complete file.




Varnita
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10489
    
    9

Can't figure out.
You say it works from the command line. The manifest file does contain a Main-Class entry.

Since you are on XP, did you try rebooting?
Anybody else?
Ramses Butarbutar
Ranch Hand

Joined: Jun 16, 2009
Posts: 52

Maybe you can open that jar, but first copy it, rename and change extension to rar(change to argouml.rar) . Find class named Main in package org.argouml.application .
If class is exist, check again your classpath, have you set all jar in class path or not (just point directory if you not sure which jar have to added into classpath) then check with command prompt if already registered.
Last, if class file not exist and classpath setting not complete. Maybe you can download a new one from
argoUML and check is it the new one work or not. If the new one still "not working" perhaps there is something "weird" in your machine.

In bundling an application into jar, some IDE provide function to register the main class that will be run at first time. Perhaps (once again :confused: ) this function registered in to windows and after you formatted your machine, it's not registered any longer. so your jar application can not find it main class.

Have a nice try... :)
 
 
subject: problems executing executable jar file by double clicking