• Post Reply Bookmark Topic Watch Topic
  • New Topic

About compiling using a Jar  RSS feed

 
Sergio Marcello
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all !

I have a question about how to compile a Java program, and using a .jar file.

The Scenario: I have downloaded a Java library ( https://sourceforge.net/projects/barcode4j/ ) in order to create Barcodes.

The example code ( SampleBarcodeEnhanced.java ) includes some functions of the barcode4j library, for example:
import org.krysalis.barcode4j.impl.datamatrix.DataMatrixBean;

In the root wher the .Java sourcecode is located, I have created a Directory structure like this: .\org\krysalis\ and in that Directory I put the barcode4j.jar file.

Now when I compile the .Java file with the command "javac ./SampleBarcodeEnhanced.java ", I get som Errors like this:

" error: package org.krysalis.barcode4j.impl.datamatrix does not exist "

The question: how should I compile that SampleBarcodeEnhanced.java ? Which Directory structure should I build in order to make it compiling ß

Thanks in advance for your Attention,
Sergio
 
Sergio Marcello
Ranch Hand
Posts: 38
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind, figured out:

(jars is a Directory where I've put all the required .jar files)

javac -cp .\jars\*;. .\SampleBarcodeEnhanced.java
java  -cp .\jars\*;. SampleBarcodeEnhanced
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!