• Post Reply Bookmark Topic Watch Topic
  • New Topic

jar file and classpath relation  RSS feed

 
yo nara
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
I am really very sorry to ask such a silly question.But I dont know the things really.
I have written one Test.java and created TestJar.jar file and when I execute the line
java -jar TestJar.jar
Then the code executes fine but If I am using any other class say Test2.class from other jar file say Test2Jar.jar in Test.java and execute the same line above.
Even if setting the classpath or unjaring the Test2Jar.jar and keeping in same folder ,the code is unable to find Test2.class what might be reason ?
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi yogi
try,
java -cp Test2Jar.jar -jar TestJar.jar
regards
maulin
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Running a jar causes the system classpath to be ignored. The Right Way[tm] to set up a classpath with jars is to include a Class-Path entry in your JAR Manifest.
- Peter
[ May 14, 2003: Message edited by: Peter den Haan ]
 
yo nara
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the first solution doesnt work
second one is correct but still i am getting error
that can not found class instead of specifying class-path in manifest file
but i will try out that
thanks for the solution
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!