How do I call JAR which is in same folder as my java file? BUT I don't want to place this JAR file into JRE>lib>ext and also I don't want to create CLASSPATH for it.

Recommended Answers

All 7 Replies

do you want to run this JAR file or do you want to import it in your application so you can use it?

Import in my application and be able to use it. Easy portable with no need to do any changes to existing system(JAVA is expected to be installed)

i think you still need to define classpath or you can create a jar file (your classes + 3rd party jars) and run from it...

you can use eclipse or netbeans for creating jars easily

that is what I want to avoid. stting up classpath

:) good luck to you but i don't think there is an another way...

nope. the JVM will ONLY load classes it can find on its classpath (and that includes your application classes, if those aren't on the classpath it won't load them).

Best set up the classpath when running the JVM, that way it's local to that instance of the JVM.
That's achieved through the -cp commandline parameter to the Java runtime.

OK I will pack it in nice installer on the end which will check for all requerements. Thank you for helping

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.