• Post Reply Bookmark Topic Watch Topic
  • New Topic

javac is not finding my classes  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have installed the bouncy castle jar files (for PKCS7 encryption in the following directory on a SuSE Linux box
(I installed them by using unzip on the jar files in this directory: /usr/java/jre1.7.0_05)

/usr/java/jre1.7.0_05

Its classes are in subdirectories of that directory: ei: org.bouncycastle.cert.jcajce

I try to compile my program in the directory where I have my two java programs: (The PKCS7Signer is a class also)

/usr/java/default/bin/javac Main.java PKCS7Signer.java -classpath /usr/java/jre1.7.0_05 -Xstdout error.txt

The classes I need from the bouncy castle aren't found because I am getting these errors:

PKCS7Signer.java:10: error: package org.bouncycastle.cert.jcajce does not exist
import org.bouncycastle.cert.jcajce.JcaCertStore;
^
PKCS7Signer.java:11: error: package org.bouncycastle.cms does not exist
import org.bouncycastle.cms.CMSProcessableByteArray;
^
PKCS7Signer.java:12: error: package org.bouncycastle.cms does not exist
import org.bouncycastle.cms.CMSSignedData;
^
PKCS7Signer.java:13: error: package org.bouncycastle.cms does not exist
import org.bouncycastle.cms.CMSSignedDataGenerator;
^
PKCS7Signer.java:14: error: package org.bouncycastle.cms does not exist
import org.bouncycastle.cms.CMSTypedData;
^
PKCS7Signer.java:15: error: package org.bouncycastle.cms.jcajce does not exist
import org.bouncycastle.cms.jcajce.JcaSignerInfoGeneratorBuilder;
^
PKCS7Signer.java:17: error: package org.bouncycastle.operator does not exist
import org.bouncycastle.operator.ContentSigner;
^
PKCS7Signer.java:18: error: package org.bouncycastle.operator.jcajce does not exist
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
^
PKCS7Signer.java:19: error: package org.bouncycastle.operator.jcajce does not exist
import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder;


I have tried many variations on the javac command to compile this. Any ideas of what I need to do in order to fix this ? Thanks.

 
Marshal
Posts: 56610
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
Jacques Gauthier wrote:Hello,

I have installed the bouncy castle jar files (for PKCS7 encryption in the following directory on a SuSE Linux box
(I installed them by using unzip on the jar files in this directory: /usr/java/jre1.7.0_05)
That’s not a good idea.

Put them somewhere else. Add the classpath with the -cp option when you are compiling. If you follow the other link from that last link, it tells you the classpath should end with the name of the .jar you are using. Try starting your classpath with / and see what happens.

 
Jacques Gauthier
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello,

I have tried moving my jars to: /usr/java/jars

Then I tried the following command:

/usr/java/default/bin/javac PKCS7Signer.java -Xstdout error.txt -classpath /usr/java/jars -cp

I am now getting this error:

javac: -cp requires an argument
Usage: javac <options> <source files>
use -help for a list of possible options

What should I put after the "-cp" ? Thanks.
 
Campbell Ritchie
Marshal
Posts: 56610
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don’t need -cp and --classpath together; they both do the same thing.
Try moving the class name last.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!