• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.jar file cant find its self

 
james heise
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21427
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
james heise
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15448
42
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic