File | Project Structure | Artifacts then you should press alt+insert or click the plus icon and create new artifact choose --> jar --> From modules with dependencies.
Next goto Build | Build artifacts --> choose your artifact.
If you have these 3 libraries :
lib1.jar
lib2.jar
lib3.jar
You have to type this:
javac -cp ".:lib1.jar;lib2.jar;lib3.jar" sourcefile.jar
java -cp ".:lib1.jar;lib2.jar;lib3.jar" sourcefile.jarjavac -cp ".:lib1.jar:lib2.jar:lib3.jar" sourcefile.jar
java -cp ".:lib1.jar:lib2.jar:lib3.jar" sourcefile.jarYou just have to replace : by ;.
javac -cp ".;lib1.jar;lib2.jar;lib3.jar" sourcefile.jar
java -cp ".;lib1.jar;lib2.jar;lib3.jar" sourcefile.jarExample :
javac -cp ".;.\be\isims\coo\tp5\ex2\lib\libClock.jar" .\be\isims\coo\tp5\ex2\ClockTest.java
java -cp ".;.\be\isims\coo\tp5\ex2\lib\libClock.jar" be.isims.coo.tp5.ex2.ClockTestIf you're using Java 5 or higher, you can use String.format:
urlString += String.format("u1=%s;u2=%s;u3=%s;u4=%s;", u1, u2, u3, u4);See Formatter for details.
To compile code from a package, for example be.heh.ex, you have to do:
javac be/heh/ex/*.javaAnd then, to run it you only have to do:
java be/heh/ex/Main