• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make available a jar file globally...?

 
Nagendhra Kumar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

Can anyone tell me how to make a jar file available globally(i mean available from any directory) so that i can run it from any directory...?

I followed the following steps eventhough i could't solve this...?

1. I created a jar file in a directory(say D:\hello.jar).
2. I set the classpath variable in the classpath.
3. Now I am trying to run that jar file from other drive(say E:\java hello.jar) but i am not able to run this...I am encountering NoClassFoundException.

Thanks in advance.
tn
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your CLASSPATH?
 
Nagendhra Kumar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My classpath is .;E:\hello.jar;
....is anything wrong with this classpath..?
 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create a regular .java (mine.java) file in which you import hello. Create your class as you normally would. Somewhere in that jar file, you have a class that you can instantiate. Create an instance of the class and write code to do whatever you need with it.

Save mine.java and compile it. Then run E:\java mine. Whatever you have programmed to happen should happen. Your classpath looks OK if hello.jar resides in the root directory of E:/.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
include the jar path in your CLASSPATH.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic