How to run a java file with a lot of jars dependencies in ubuntu

jar, java, terminal, ubuntu

Solution

if you have single class in your app called `flights.java` and all of your required jar are located at `/home/ubuntu/test/libs/` then use this

javac -cp '.:/home/ubuntu/test/libs/*.jar' flights.java

and to run

java -cp '.:/home/ubuntu/test/libs/*.jar' flights

better to just pack dependency and app in to a single jar and make it launchable and runnable jar

Problem

I have a java class which has almost 12 jar file dependencies and i am using ubuntu 12.10 . I need to know how to run this java application because every time i run it , it gives me errors as "symbols not found". I have all jar files in a folder called libs. and i have tried these commands but none of these gives me some succesful result.I have flights.java class in test directory and libs directory is inside test directory.Currently i am in test directory javac -cp "/home/ubuntu/test/libs/*.jar" flights.java javac -cp '/home/ubuntu/test/libs/*.jar' flights.java

Original source

Related problems