my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Jar doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Jar doubt" Watch "Jar doubt" New topic

Jar doubt

Ranch Hand

Joined: Apr 04, 2007
Posts: 188
1>suppose i wrote a program called which is in package ab
2>now the HelloUsa.class files ie i created a jar file called prasanna.jar
3>now i put the(my prasanna.jar) jar file in .../jre/lib/ext
4>Actually my program should run when i execute java HelloUsa even if there is no .class files in my current dir for where i compile

is it right??
Rob Spoor

Joined: Oct 27, 2005
Posts: 19655

Not quite.

Because the class is in a package, the .class file should be in a folder called ab in the JAR file, and you should call the app using "java ab.HelloUSA". You are 100% correct about not needing to specify a classpath because the JAR file is in the /jre/lib/ext folder.

How To Ask Questions How To Answer Questions
It is sorta covered in the JavaRanch Style Guide.
subject: Jar doubt
Similar Threads
Jar file problems
Jar file Problem
Deploying EJB in Websphere via Ant
Accessing text files outside eclipse
jar file classpath