You can do :
1) javac -cp /path/to/jar/file Myprogram.java
2) java -cp .:/path/to/jar/file Myprogram
So, lets suppose your current working directory
in terminal is src/Report/
javac -cp src/external/myfile.jar Reporter.java
java -cp .:src/external/myfile.jar Reporter
Take a look here to setup Classpath
Related Contents:
- What is the maven-shade-plugin used for, and why would you want to relocate Java packages?
- Reading a resource file from within jar
- Access restriction: The type ‘Application’ is not API (restriction on required library rt.jar)
- Run class in Jar file
- Add JAR files to a Spark job – spark-submit
- Extract source code from .jar file
- How to build sources JAR with Gradle?
- Creating runnable JAR with Gradle
- Build project into a JAR automatically in Eclipse
- Create an Android Jar library for distribution
- Is it possible to rename a maven jar-with-dependencies?
- Eclipse error: “The import XXX cannot be resolved”
- Including jars in classpath on commandline (javac or apt)
- How to list the files inside a JAR file?
- Execute another jar in a Java program
- Gradle – no main manifest attribute
- Jar Mismatch Found 2 versions of android-support-v4.jar in the dependency list
- Eclipse “Error: Could not find or load main class”
- Is there a quick way to delete a file from a Jar / war without having to extract the jar and recreate it?
- Comparing two .jar files
- How to bundle a native library and a JNI library inside a JAR?
- How to make a .jar out from an Android Studio project
- What exactly does a jar file contain?
- How to convert AAR to JAR
- Java Eclipse: Difference between exporting as a JAR and exporting as a Runnable JAR
- Difference between maven plugins ( assembly-plugins , jar-plugins , shaded-plugins)
- Extracting jar to specified directory
- Eclipse how to link a jar containing javadocs/source with its binary?
- Easiest way to merge a release into one JAR file
- How to list dependencies of a JAR
- Java: how to import a jar file from command line
- NoClassDefFoundError while trying to run my jar with java.exe -jar…what’s wrong?
- Creating a bundle jar with ant
- Eclipse is confused by imports (“accessible from more than one module”)
- Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError
- Find a jar file given the class name?
- Multiple runnable classes inside JAR, how to run them?
- Execute jar file with multiple classpath libraries from command prompt
- equivalent to Files.readAllLines() for InputStream or Reader?
- How to use JarOutputStream to create a JAR file?
- How do you extract a JAR in a UNIX filesystem with a single command and specify its target directory using the JAR command?
- Reference jars inside a jar
- How to reference a resource file correctly for JAR and Debugging?
- Packaging jar is invalid Aggregator project need pom as packaging
- how can I debug a jar at runtime?
- Checking Maven Version
- Maven Error: Could not find or load main class
- “Launch Configuration” Shows up Blank When Trying to Export Runnable Jar?
- How Do I Automatically Generate A .jar File In An Eclipse Java Project
- What jar should I include to use javax.persistence package in a hibernate based application?