This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Main class not found  RSS feed

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run a .jar file on vista but its giving me an error " Main class not found " however the program run on windows XP



 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That class is missing in the classpath. Check your %CLASSPATH% environment variable, check the current working path, check the -cp or -classpath parameter (which are in fact overriding the %CLASSPATH% environment variable), check the JAR´s manifest. For a more detailed answer, you need to give more detailed information.

After all I would consider this as a "Java in general (Beginner)" question.
 
Ranch Hand
Posts: 106
Mac Mac OS X Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//there's no reason to be aggresive with a fellow rancher, Bauke...

ok, i dont know if it will work, but try doing this:

  • look on the manifest file the exact name of your main class, and try to locate it on your current working path on XP, then try locating the same with the same jar file on vista...
  • be sure that your jar file is the same
  • check your classpath for missing files, files that is in XP's classpath but not on vista's


  • I dont see that as being a solution for you, so, please, i mean, please, provide us some more information, so that you can get helpful reponses, not just guesses....
     
    Bauke Scholtz
    Ranch Hand
    Posts: 2458
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Lucas Franceschi wrote: //there's no reason to be aggresive with a fellow rancher, Bauke...

    I didn´t shoot him off or so? Were you referring to the last sentence? I don´t know what you think, but how the classpath works is covered by every decent Basic Java book/tutorial. So I don´t see how you see it as agressive.
     
    Mohamad Obagi
    Ranch Hand
    Posts: 37
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    this is the manifest:


    part of Main class

     
    author and iconoclast
    Sheriff
    Posts: 24220
    40
    Chrome Eclipse IDE Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The line

    Class-Path: lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar

    means that this JAR file needs files named appframework-1.0.3.jar and swing-worker-1.1.jar in a lib/ directory sitting next to it to run. These things must be installed on the other machine where it works.
     
    Mohamad Obagi
    Ranch Hand
    Posts: 37
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    oh yes it may be the problem :S didn't notice it

    thanks for the help
     
    Sheriff
    Posts: 21453
    96
    Chrome Eclipse IDE Java Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The javaw.exe executable, that will run JAR files when double-clicking, is quite bad in its error messages. Basically, everything that will go wrong is a "main class" error.

    If you ever get this message, run the JAR file from the console:

    This will print out the real stack trace. In your case it would probably print a ClassDefNotFoundError.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!