i'm trying to compile my file.java with an optimization problem with CPLEX notation in a cluster wich use linux (an i'm a windows user) and a used (through and application to send commands)
javac file.java
and i get errors like :
file.java:4: error: package ilog.concert does not exist
import ilog.concert.IloException;
^
file.java:5: error: package ilog.concert does not exist
import ilog.concert.IloLinearNumExpr;
^
file.java:6: error: package ilog.concert does not exist
import ilog.concert.IloNumVar;
^
file.java:7: error: package ilog.concert does not exist
import ilog.concert.IloNumVarType;
^
file.java:8: error: package ilog.concert does not exist
import ilog.concert.IloRange;
^
file.java:9: error: package ilog.cplex does not exist
import ilog.cplex.IloCplex;
So it don't recognize the library (and therefore the imports) wich is supposedly in this ubication in the cluster
/home/apps/cplex/12.6.1/cplex/lib/cplex.jar
My question is, do I have to add something to the javac command line or is not connected the paths (like int Windows)?
Use the -cp
command line argument to add the jar file to your compile-time classpath. You'll need to specify the classpath when you run the code too.
$ javac -cp /home/apps/cplex/12.6.1/cplex/lib/cplex.jar file.java
$ java -cp /home/apps/cplex/12.6.1/cplex/lib/cplex.jar:. file
Ideally, start using Java packages rather than the default package, and follow Java naming conventions.
Also, if you're not familiar with Java to start with, I would read some tutorials etc before you start trying to run anything complex like this.
See more on this question at Stackoverflow