Results 1 to 16 of 16
Thread: beginner to Java
- 04-16-2008, 05:06 AM #1
Member
- Join Date
- Apr 2008
- Posts
- 9
- Rep Power
- 0
beginner to Java
I am a beginner with Java. I just installed the Bouncy Castle provider and would like to test some sample codes to see if everything is correctly installed. I downloaded a zip file that contains all of the example code. My question is: Can I run this code straight from a folder on the desktop or does it have to be placed in a certain place in order for it to compile? I thought I all I need is the provider to start using the library. Is this correct or do I need some extra files?
Thanks in advance.
- 04-16-2008, 08:59 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
First of all, welcome to Java Forums.
After downloading samples what you have done. Try to open a file and compile? If so any errors?
- 04-16-2008, 04:42 PM #3
Yes, you can, if you already set the bin folder in the classpath...Can I run this code straight from a folder on the desktop or does it have to be placed in a certain place in order for it to compile?
or if none, you have to compile it in the jdk's bin folder where javac.exe exists.
regards,
sukatoa
- 04-17-2008, 01:30 AM #4
Member
- Join Date
- Apr 2008
- Posts
- 9
- Rep Power
- 0
I set the PATH (both User and System variables) as C:\Program Files\Java\jdk1.6.0_05\bin in the Environmental Variables. Is this what you mean? OR do I need to another variable containing the location of the BouncyCastle provider?
Thanks for your help!
EDIT:
I set the CLASSPATH variable in both User and System variables to:
.;C:\Program Files\Java\jre1.6.0_05\lib\ext; C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext;
but when I try compiling the code I'm getting the error. (cannot find symbol errors)
I followed all other rules yet it still will not compile.Last edited by notwist; 04-17-2008 at 02:20 AM.
- 04-17-2008, 03:22 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Can you put the complete compile error to see. Seems to me something wrong with your code. Are sure that your code is error free?
- 04-17-2008, 03:34 AM #6
Member
- Join Date
- Apr 2008
- Posts
- 9
- Rep Power
- 0
I think the code is error free since it's some example code supplied with BC. I checked the code to make sure that the package structure is setup properly and all the imported classes are present. I think it might be something with the classpath although the directory in the classpath does contain the providers.
Here is the errors along with my classpath:
Am i compiling this correctly? is the classpath correct?Java Code:C:\org\bouncycastle\crypto\test>dir Volume in drive C has no label. Volume Serial Number is 004A-9ED9 Directory of C:\org\bouncycastle\crypto\test 04/16/2008 08:10 PM <DIR> . 04/16/2008 08:10 PM <DIR> .. 07/06/2005 11:02 PM 670 BigIntegerTest.java 12/30/2005 03:02 PM 1,575 CryptoRegressionTest.java 07/06/2005 11:02 PM 9,700 RSATest.java 04/16/2008 08:34 PM 1,865 RegressionTest.java 11/25/2006 02:51 PM 58,188 GOST3410Test.java 11/11/2006 07:46 PM 14,484 GOST28147Test.java 04/16/2008 08:39 PM 6,946 RSATest.class 7 File(s) 93,428 bytes 2 Dir(s) 1,807,384,576 bytes free C:\org\bouncycastle\crypto\test>set CLASSPATH CLASSPATH=.;C:\Program Files\Java\jre1.6.0_05\lib\ext; C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext; C:\org\bouncycastle\crypto\test>javac RegressionTest.java RegressionTest.java:15: cannot find symbol symbol : class AESTest location: class org.bouncycastle.crypto.test.RegressionTest new AESTest(), ^ RegressionTest.java:16: cannot find symbol symbol : class DESTest location: class org.bouncycastle.crypto.test.RegressionTest new DESTest(), ^ RegressionTest.java:17: cannot find symbol symbol : class DESedeTest location: class org.bouncycastle.crypto.test.RegressionTest new DESedeTest(), ^ RegressionTest.java:18: cannot find symbol symbol : class ModeTest location: class org.bouncycastle.crypto.test.RegressionTest new ModeTest(), ^ RegressionTest.java:19: cannot find symbol symbol : class DHTest location: class org.bouncycastle.crypto.test.RegressionTest new DHTest(), ^ RegressionTest.java:20: cannot find symbol symbol : class ElGamalTest location: class org.bouncycastle.crypto.test.RegressionTest new ElGamalTest(), ^ RegressionTest.java:21: cannot find symbol symbol : class DSATest location: class org.bouncycastle.crypto.test.RegressionTest new DSATest(), ^ RegressionTest.java:22: cannot find symbol symbol : class ECTest location: class org.bouncycastle.crypto.test.RegressionTest new ECTest(), ^ RegressionTest.java:23: cannot find symbol symbol : class ECIESTest location: class org.bouncycastle.crypto.test.RegressionTest new ECIESTest(), ^ RegressionTest.java:24: cannot find symbol symbol : class MacTest location: class org.bouncycastle.crypto.test.RegressionTest new MacTest(), ^ RegressionTest.java:25: cannot find symbol symbol : class RC2Test location: class org.bouncycastle.crypto.test.RegressionTest new RC2Test(), ^ RegressionTest.java:26: cannot find symbol symbol : class RC4Test location: class org.bouncycastle.crypto.test.RegressionTest new RC4Test(), ^ RegressionTest.java:27: cannot find symbol symbol : class RC5Test location: class org.bouncycastle.crypto.test.RegressionTest new RC5Test(), ^ RegressionTest.java:28: cannot find symbol symbol : class RC6Test location: class org.bouncycastle.crypto.test.RegressionTest new RC6Test(), ^ RegressionTest.java:29: cannot find symbol symbol : class RijndaelTest location: class org.bouncycastle.crypto.test.RegressionTest new RijndaelTest(), ^ RegressionTest.java:30: cannot find symbol symbol : class SerpentTest location: class org.bouncycastle.crypto.test.RegressionTest new SerpentTest(), ^ RegressionTest.java:31: cannot find symbol symbol : class SkipjackTest location: class org.bouncycastle.crypto.test.RegressionTest new SkipjackTest(), ^ RegressionTest.java:32: cannot find symbol symbol : class BlowfishTest location: class org.bouncycastle.crypto.test.RegressionTest new BlowfishTest(), ^ RegressionTest.java:33: cannot find symbol symbol : class TwofishTest location: class org.bouncycastle.crypto.test.RegressionTest new TwofishTest(), ^ RegressionTest.java:34: cannot find symbol symbol : class CAST5Test location: class org.bouncycastle.crypto.test.RegressionTest new CAST5Test(), ^ RegressionTest.java:35: cannot find symbol symbol : class CAST6Test location: class org.bouncycastle.crypto.test.RegressionTest new CAST6Test(), ^ RegressionTest.java:36: cannot find symbol symbol : class IDEATest location: class org.bouncycastle.crypto.test.RegressionTest new IDEATest(), ^ RegressionTest.java:37: cannot find symbol symbol : class CamelliaTest location: class org.bouncycastle.crypto.test.RegressionTest new CamelliaTest(), ^ RegressionTest.java:38: cannot find symbol symbol : class RSATest location: class org.bouncycastle.crypto.test.RegressionTest new RSATest(), ^ RegressionTest.java:39: cannot find symbol symbol : class ISO9796Test location: class org.bouncycastle.crypto.test.RegressionTest new ISO9796Test(), ^ RegressionTest.java:40: cannot find symbol symbol : class MD2DigestTest location: class org.bouncycastle.crypto.test.RegressionTest new MD2DigestTest(), ^ RegressionTest.java:41: cannot find symbol symbol : class MD4DigestTest location: class org.bouncycastle.crypto.test.RegressionTest new MD4DigestTest(), ^ RegressionTest.java:42: cannot find symbol symbol : class MD5DigestTest location: class org.bouncycastle.crypto.test.RegressionTest new MD5DigestTest(), ^ RegressionTest.java:43: cannot find symbol symbol : class SHA1DigestTest location: class org.bouncycastle.crypto.test.RegressionTest new SHA1DigestTest(), ^ RegressionTest.java:44: cannot find symbol symbol : class SHA256DigestTest location: class org.bouncycastle.crypto.test.RegressionTest new SHA256DigestTest(), ^ RegressionTest.java:45: cannot find symbol symbol : class SHA384DigestTest location: class org.bouncycastle.crypto.test.RegressionTest new SHA384DigestTest(), ^ RegressionTest.java:46: cannot find symbol symbol : class SHA512DigestTest location: class org.bouncycastle.crypto.test.RegressionTest new SHA512DigestTest(), ^ RegressionTest.java:47: cannot find symbol symbol : class RIPEMD128DigestTest location: class org.bouncycastle.crypto.test.RegressionTest new RIPEMD128DigestTest(), ^ RegressionTest.java:48: cannot find symbol symbol : class RIPEMD160DigestTest location: class org.bouncycastle.crypto.test.RegressionTest new RIPEMD160DigestTest(), ^ RegressionTest.java:49: cannot find symbol symbol : class TigerDigestTest location: class org.bouncycastle.crypto.test.RegressionTest new TigerDigestTest(), ^ RegressionTest.java:50: cannot find symbol symbol : class MD5HMacTest location: class org.bouncycastle.crypto.test.RegressionTest new MD5HMacTest(), ^ RegressionTest.java:51: cannot find symbol symbol : class SHA1HMacTest location: class org.bouncycastle.crypto.test.RegressionTest new SHA1HMacTest(), ^ RegressionTest.java:52: cannot find symbol symbol : class RIPEMD128HMacTest location: class org.bouncycastle.crypto.test.RegressionTest new RIPEMD128HMacTest(), ^ RegressionTest.java:53: cannot find symbol symbol : class RIPEMD160HMacTest location: class org.bouncycastle.crypto.test.RegressionTest new RIPEMD160HMacTest(), ^ RegressionTest.java:54: cannot find symbol symbol : class OAEPTest location: class org.bouncycastle.crypto.test.RegressionTest new OAEPTest(), ^ RegressionTest.java:55: cannot find symbol symbol : class PSSTest location: class org.bouncycastle.crypto.test.RegressionTest new PSSTest(), ^ RegressionTest.java:56: cannot find symbol symbol : class CTSTest location: class org.bouncycastle.crypto.test.RegressionTest new CTSTest(), ^ RegressionTest.java:57: cannot find symbol symbol : class PKCS5Test location: class org.bouncycastle.crypto.test.RegressionTest new PKCS5Test(), ^ RegressionTest.java:58: cannot find symbol symbol : class PKCS12Test location: class org.bouncycastle.crypto.test.RegressionTest new PKCS12Test(), ^ RegressionTest.java:59: cannot find symbol symbol : class GOST28147Test location: class org.bouncycastle.crypto.test.RegressionTest new GOST28147Test(), ^ RegressionTest.java:60: cannot find symbol symbol : class GOST3410Test location: class org.bouncycastle.crypto.test.RegressionTest new GOST3410Test(), ^ RegressionTest.java:61: cannot find symbol symbol : class WhirlpoolDigestTest location: class org.bouncycastle.crypto.test.RegressionTest new WhirlpoolDigestTest() ^ 47 errors C:\org\bouncycastle\crypto\test>
Thanks for helping me with this.
- 04-17-2008, 03:51 AM #7
Debugging time!!!! :)
regards,
sukatoa
- 04-17-2008, 04:00 AM #8
Member
- Join Date
- Apr 2008
- Posts
- 9
- Rep Power
- 0
The code was sample code from the BC zip file plus they are all the same type of error. i think it might be something with my classpath or how i am compiling the program
I didn't even write this code but here it is anyways
Java Code:package org.bouncycastle.crypto.test; import org.bouncycastle.crypto.test.GOST28147Test; import org.bouncycastle.crypto.test.GOST3410Test; import org.bouncycastle.util.test.*; public final class RegressionTest { private RegressionTest() { }; private static Test[] _tests = { new AESTest(), new DESTest(), new DESedeTest(), new ModeTest(), new DHTest(), new ElGamalTest(), new DSATest(), new ECTest(), new ECIESTest(), new MacTest(), new RC2Test(), new RC4Test(), new RC5Test(), new RC6Test(), new RijndaelTest(), new SerpentTest(), new SkipjackTest(), new BlowfishTest(), new TwofishTest(), new CAST5Test(), new CAST6Test(), new IDEATest(), new CamelliaTest(), new RSATest(), new ISO9796Test(), new MD2DigestTest(), new MD4DigestTest(), new MD5DigestTest(), new SHA1DigestTest(), new SHA256DigestTest(), new SHA384DigestTest(), new SHA512DigestTest(), new RIPEMD128DigestTest(), new RIPEMD160DigestTest(), new TigerDigestTest(), new MD5HMacTest(), new SHA1HMacTest(), new RIPEMD128HMacTest(), new RIPEMD160HMacTest(), new OAEPTest(), new PSSTest(), new CTSTest(), new PKCS5Test(), new PKCS12Test(), new GOST28147Test(), new GOST3410Test(), new WhirlpoolDigestTest() }; public static void main( String[] args) { for (int i = 0; i != _tests.length; i++) { TestResult result = _tests[i].perform(); System.out.println(result); } } }Last edited by notwist; 04-17-2008 at 04:02 AM.
- 04-17-2008, 04:11 AM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Seems to me few classes are can't find there. Like AESTest ans do many.
And also, set the class path as follows and try.
Then use javac to compile and java to run the application.Java Code:path=C:\Program Files\Java\jdk1.6.0_05\bin\
- 04-17-2008, 04:33 AM #10
Member
- Join Date
- Apr 2008
- Posts
- 9
- Rep Power
- 0
Hmm, I changed the classpath but i'm still getting those errors.
I tried compiling another example program and while it did compile, I got an error when I tried running it.
Java Code:C:\Documents and Settings\Bill\Desktop\crypto-139\src\org\bouncycastle\crypto\examples>javac DESExample.java C:\Documents and Settings\Carl\Desktop\crypto-139\src\org\bouncycastle\crypto\examples>java DESExample Exception in thread "main" java.lang.NoClassDefFoundError: DESExample Caused by: java.lang.ClassNotFoundException: DESExample at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) C:\Documents and Settings\Bill\Desktop\crypto-139\src\org\bouncycastle\crypto\examples>
- 04-17-2008, 04:37 AM #11
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
So few classes are missing in you package. Are you sure you have collect the complete set of classes. As I said on my previous replay there are few classes missing, you get FileNotFoundException.
- 04-17-2008, 04:43 AM #12
Member
- Join Date
- Apr 2008
- Posts
- 9
- Rep Power
- 0
Are you talking about the last program I posted. I will have to look into this and see. But I thought only the Provider was needed to compile these programs? I guess i was mistaken.
- 04-17-2008, 04:58 AM #13
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 04-17-2008, 04:40 PM #14
Member
- Join Date
- Apr 2008
- Posts
- 9
- Rep Power
- 0
I set the classpath to point to the provider, changed the security file, and checked everything yet I'm still getting these errors. This is getting annoying!
- 04-17-2008, 07:23 PM #15
Could you give a link or something so we can download the samples. I would like to check them out....
-- www.firemelt.net --
Cheer up, the worst has yet to come...
- 04-18-2008, 09:41 AM #16
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
Beginner; Create a class to store info and constructor to initialize
By badness in forum New To JavaReplies: 16Last Post: 05-08-2008, 09:45 PM -
Beginner-Moderate IDE
By Hiro ZA in forum NetBeansReplies: 4Last Post: 01-26-2008, 06:16 AM -
Beginner Needs Help w/ Program for School
By badness in forum New To JavaReplies: 2Last Post: 11-24-2007, 07:51 PM -
beginner needs help with OBD-II input
By andrewos in forum New To JavaReplies: 3Last Post: 07-30-2007, 09:46 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks