i'm trying todo the following:
i have a jar file, this is what i do run first.
Then i have a class that i want to run, which has to access a class in the jar file
Why? I'm learning reflection.
I'm my folder i have this:
jars/file.jar which is the jar file i run first
Test.class - which calls the class.forName(classname); to acces the class in the jar file.
This is the following i have:
but doesn't work. ANy idfeas???
C:> java "-classpath C:\Documents and Settings\xxx\Bureaublad\xxx\jars\file.jar"
Thanks in advance!
If you want to run files.jar then this command will run it:
java -jar file.jar
java -jar jars/file.jar
If you want to use file.jar with Test then this will include it in the classpath: java -cp .;/jars/file.jar Test
I advise experimenting from the command line.
Also, provide us with error messages.
No, you don't understand:
I run the jar file first, this is a application. (NO problems here)
Then i have a Test.class outside the jar file, only in the same folder.
The Test class contains Class.forName("class inside the jar file");
So i can use reflection on this class.
but i have to include the jar file in some way, else it keeps printing classnotfoundexception
Thanks for the reply though
Including the classpath as I suggested works.
java -cp .;jars/file.jar Test
Otherwise you have given the wrong class name.
Ok, sorry, didn't try it yet. I'll try tomorrow and let you know.
Thanks for the reply!
Finnaly, somebody who helps me correctly.
Thank you very much!