Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't find ..\lib\ext\ packages

 
Alex Prawira
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I got some problem here.
I have my package named MyGeometry.jar
I have an application that use clasess from that package, called DrawingAppl
But when i want to run my DrawingAppl, the application won't start, throwing "... not found exception"

I suppose the clasess and packages in the .jar archive that i places in the "ext" folder will automatically be

accessible when you run my Java programs, without need -classpath command.


I'm in --> "D:\TestAppl\classes"

Commands that don't work
--------------------------------
java "DrawingAppl"
java -cp "D:\TestAppl\classes" "DrawingAppl"
java -cp "C:\j2sdk1.4.2_05\jre\lib\ext;D:\TestAppl\classes" "DrawingAppl"


Only this that work !
------------------------------
java -cp "C:\j2sdk1.4.2_05\jre\lib\ext\MyGeometry.jar;D:\TestAppl\classes" "DrawingAppl"

I'm so confused about this problem. Please help me.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you have classes in a .jar file, you must add the jar file itself to the classpath. Simply adding the directory that contains the jar file isn't enough. That's why only the last one works.

Layne
 
Ajay Bhargov
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

I think that once you store all your .jar files in the ext folder present inside the java directory , it will be automatically be loaded. There is no need to add the .jar file to the classpath.
 
Premil Jacob
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If ur main startup class file is in the jar file you can run it using the following command

java -jar <main class name>
 
Premil Jacob
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i missed out the jar file name before

its
java -jar <jar file name> <main class name>
 
Surasak Leenapongpanit
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See The Extension Mechanism.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic