Reputation: 1857
I have a java file called EXICodec.java
which performs various operations thanks to the jar exificient.jar
. They are in the same folder.
Here is the structure of the file EXICodec.java
:
import java.io.FileInputStream;
import java.io.FileOutputStream;
[...]
import com.siemens.ct.exi.helpers.DefaultEXIFactory;
public class EXICodec {
/*
* Main
*/
public static void main(String[] args)
{
for (int i=0;i < args.length ; i++)
{
System.out.println(args[i]);
}
}
/*
* Attributes
*/
[...]
/*
* Constructor (default)
*/
public EXICodec()
{[...]}
/*
* Methods using import from exificient.jar
*/
[...]
When I compile, I run the following command : (and it works)
javac -cp exificient.jar EXICodec.java
And then I want to execute:
java -cp exificient.jar EXICodec
but I have the following error :
Error : java could not find or load main class EXICodec
Am I missing some basic thing ? I thought it was link to the package name. I had one and place the file in the proper folder but I got the same problems : it compiles but does not run.
Upvotes: 0
Views: 136
Reputation:
You need to add the location of EXICodec.class
to the classpath.
Something along the lines of
java -cp "exificient.jar:." EXICodec
(assuming you're on Unix)
Upvotes: 0
Reputation: 206776
Add the current directory (that contains the file EXICodec.class
) to the classpath:
java -cp exificient.jar;. EXICodec
The current directory is indicated by .
If you are using a Unix-like operating system (Mac OS X or Linux) instead of Windows, use :
instead of ;
as the path separator:
java -cp exificient.jar:. EXICodec
Upvotes: 1