Results 1 to 16 of 16
  1. #1
    notwist is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default 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.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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?

  3. #3
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    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?
    Yes, you can, if you already set the bin folder in the classpath...
    or if none, you have to compile it in the jdk's bin folder where javac.exe exists.

    regards,
    sukatoa

  4. #4
    notwist is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    Quote Originally Posted by sukatoa View Post
    Yes, you can, if you already set the bin folder in the classpath...
    or if none, you have to compile it in the jdk's bin folder where javac.exe exists.

    regards,
    sukatoa
    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 03:20 AM.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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?

  6. #6
    notwist is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    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:

    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>
    Am i compiling this correctly? is the classpath correct?
    Thanks for helping me with this.

  7. #7
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    Debugging time!!!! :)

    regards,
    sukatoa

  8. #8
    notwist is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    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 05:02 AM.

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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.

    Java Code:
    path=C:\Program Files\Java\jdk1.6.0_05\bin\
    Then use javac to compile and java to run the application.

  10. #10
    notwist is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    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>

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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.

  12. #12
    notwist is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    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.

  13. #13
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by notwist View Post
    But I thought only the Provider was needed to compile these programs? I guess i was mistaken.
    May be. You can compile the code, because reference not used in compile time here. You have already done it. But you can't run it. Check what your provider want to do :)

  14. #14
    notwist is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    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!

  15. #15
    bobleny's Avatar
    bobleny is offline Member
    Join Date
    Apr 2008
    Posts
    50
    Rep Power
    0

    Default

    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...

  16. #16
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by bobleny View Post
    Could you give a link or something so we can download the samples. I would like to check them out....
    Yes, it could be a good point. :)

Similar Threads

  1. Replies: 16
    Last Post: 05-08-2008, 10:45 PM
  2. Beginner-Moderate IDE
    By Hiro ZA in forum NetBeans
    Replies: 4
    Last Post: 01-26-2008, 07:16 AM
  3. Beginner Needs Help w/ Program for School
    By badness in forum New To Java
    Replies: 2
    Last Post: 11-24-2007, 08:51 PM
  4. beginner needs help with OBD-II input
    By andrewos in forum New To Java
    Replies: 3
    Last Post: 07-30-2007, 10:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •