• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javac is not finding my classes

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic