SolidusAbi
SolidusAbi

Reputation: 43

Making a ImageJ .jar from command line

I have modified a ImageJ source code and i have compiled from command line, using the javac command, but Im trying to create a .jar file and I need help.

It is the first time that I'm trying to compile and create .jar from command line. When I created the .jar, I did the next command:

jar cf test.jar ImageJ/ij/*

Directory "ImageJ/ij/" contains the compiled code.

It doesn't fail but when I'm trying to execute the .jar It returns the error "Failed to load Main-Class manifest attribute from test.jar". When I execute a .jar I always do "java -jar file.jar" but, in this case, It doesn't work.

If I execute "java -cp test.jar ij.ImageJ" (ij.ImageJ is the Main Class) It works but I need to execute a macro in Batch mode and... It fails.

java -cp test.jar ij.ImageJ -batch ../MacrosIJ/helloWorld.ijm
  Exception in thread "main" java.awt.HeadlessException: 
  No X11 DISPLAY variable was set, but this program performed an operation  which requires it.
  ...

If I create the .jar in Eclipse It works perfectly, Can someone explain what i am doing wrong?. If someone can help I will be grateful. Thanks!!

Upvotes: 0

Views: 321

Answers (1)

Jan Eglinger
Jan Eglinger

Reputation: 4090

The recommended way to build ImageJ from source is using Maven:

git clone https://github.com/imagej/ImageJA.git
mvn
cd target
java -cp ij-1.50.jar ij.ImageJ

Upvotes: 3

Related Questions