wood burning stoves*
The moose likes Java in General and the fly likes .jar file cant find its self Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark ".jar file cant find its self" Watch ".jar file cant find its self" New topic
Author

.jar file cant find its self

james heise
Greenhorn

Joined: Jun 27, 2012
Posts: 2
well i made a client for one of my games and when i click on the .jar file all it give me is a error message saying.

Error: could not find or load main class: C:\Users\ James\desktop\client.jar

than is closes fast i do not know how to fix this.
don't know if my java download is corrupt or something is just wrong if you have any ideas please comment thank you
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18754
    
  40

james heise wrote:well i made a client for one of my games and when i click on the .jar file all it give me is a error message saying.

Error: could not find or load main class: C:\Users\ James\desktop\client.jar

than is closes fast i do not know how to fix this.
don't know if my java download is corrupt or something is just wrong if you have any ideas please comment thank you


Open a command window, and run the jar file from the command line. This way, the window doesn't disappear -- and taking the error messages with it.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
james heise
Greenhorn

Joined: Jun 27, 2012
Posts: 2
i am sorry i do not know alot about java like i know how to code the information in my game to get what i want but i do not know evan what a command window is i am sorry if you can teamveiwer me and show me that would be perfect if possible.
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1761
    
    7

A command window / command prompt would be your operating system's command-line interpreter, for instance on Windows it would be cmd.exe, and on a unix system it would be one of the shells e.g. bourne, bash etc.
Give the path in the error message, I would say you're running a windows system, so just open cmd.exe (Start button -> Run... -> cmd), and try running the .jar file with the java command (use the -jar flag).

Welcome to Javaranch, by the way


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

This might mean that the Main-Class attribute in the manifest file of the JAR is not set, or not set correctly. What does the manifest file of your JAR look like?

See Packaging Programs in JAR Files in Oracle's Java Tutorials; specifically the part Setting an Application's Entry Point.

If you do not know what the Windows command prompt window is, then lookup some tutorials.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: .jar file cant find its self