• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jar doubt

 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1>suppose i wrote a program called HelloUsa.java 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 HelloUsa.java 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
Sheriff
Pie
Posts: 20494
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic