Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

The jar file wouldnt run

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am begginer in Java. I tried to run Jar file from my desktop by double click or using command prompt. I created manifest and gave the class name [package name].[class name] of my java file.
With the command prompt I manage to create the class then jar file on desktop . The problem come when I try double click the jar file it just wont start. When I try to run it from the CMD Error ' the directory couldnt be found and some times It says main class couldnt be found. what shall i do??
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What command did you issue from the command line?
 
rohu meti
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tony Docherty wrote:What command did you issue from the command line?



1. javac : [Youtube.java]
-----I got class name: Youtube.class
2. Jar cfm Youtube.jar manifest.txt example1.Youtube.class (as my class in inside the package name example1)
error comes

when i try writing with out package name
Jar cfm Youtube.jar manifest.txt Youtube.class
Youtube.jar would be created on desktop

however double clicking not work
when i give this cmd in the cmd promt;
java -jar Youtube.jar
error main class not found prompt


java -jar [name of my jar file].jar
 
Tony Docherty
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

2. Jar cfm Youtube.jar manifest.txt example1.Youtube.class (as my class in inside the package name example1)



Assuming you are running the command from the parent directory of example1 on a windows machine, that should be:

You specify the file as a file path not as a Java package + name ie use '\' rather than '.'.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic