Skip to main content

DiscCreation tools error

8 replies [Last post]
praella
Offline
Joined: 2010-07-04
Points: 0

Hi,
I am new to BD-J and to this mailing list. Any help would be highly appreciated.

I am trying to compile/build the BD tools, whose sources I downloaded from hdcookbook project.
As described in the README files, I tried to build the classes.zip file.
I got all the required zip files/folders in place, including with the Javadocs stubs from BDA. Once I invoked build.sh on the main folder, the build went through successfully and it created classes.zip both in 'interactive', as well as 'enhanced' folders.
I then tried to run 'ant all' on the 'HDCookbook' folder, and the build seems to have gone fine.
I am able to see the classes BDCertGenerator.class, BDSigner.class etc in the folder 'security->build->classes->net->java->bd->tools->security'.
However, when I tried to run the tool BDCertGenerator as described in the README file, as below:

java net.java.bd.tools.security.BDCertGenerator -root 7fff0001

I am getting the following error (I set the environment variables SEC_JAR, BC_JAR, TOOLS_JAR, and CLASSPATH correctly - think so!).

PRaella@PRAELLALT01 /cygdrive/c/Java_ME_platform_SDK_3.0/HDCookbookEclipseWorksp
ace/HDCookbook/DiscCreationTools/security/build/classes/net/java/bd/tools/securi
ty
$ java BDCertGenerator -root 7fff0001
Exception in thread "main" java.lang.NoClassDefFoundError: BDCertGenerator (wron
g name: net/java/bd/tools/security/BDCertGenerator)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: BDCertGenerator. Program will exit.

PRaella@PRAELLALT01 /cygdrive/c/Java_ME_platform_SDK_3.0/HDCookbookEclipseWorksp
ace/HDCookbook/DiscCreationTools/security/build/classes/net/java/bd/tools/securi
ty
$

Many thanks in advance ...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dekz
Offline
Joined: 2010-07-04
Points: 0

Why not attempt to add the class path in the actual java command. java -cp
net.java.bd.tools.security.BDCertGenerator

NoClassDefFoundError normally indicates theres a problem with the class path.

praella
Offline
Joined: 2010-07-04
Points: 0

Hi,
I have already tried specifying the actual path in the command, but that did not help me. It was giving the same error. Any other ideas?

Thanks

dekz
Offline
Joined: 2010-07-04
Points: 0

Not sure, either there is still a path problem or something above my head has gone wrong.

I just got it working using -cp args on java and pointing it to the security.jar I built, the bouncycastle jar.

java -cp /Users/dekz/Documents/hdcookbook/DiscCreationTools/security/build/security.jar:/Users/dekz/Documents/lib/bcprov-jdk15-145.jar net.java.bd.tools.security.BDCertGenerator -root 7fff0001

received "Certificate stored in file "

billf
Offline
Joined: 2004-02-13
Points: 0

You need to be in the directory <...>/HDCookbook/DiscCreationTools/security/build/classes , and not the subdirectory .../net/java/bd/tools/security. Then, the command would be:

java net.java.bd.tools.security.BDCertGenerator -root 7fff0001

Cheers,

Bill

praella
Offline
Joined: 2010-07-04
Points: 0

Thanks for the quick reply Bill. I have done from the directory that you mentioned. I am now getting a different error as below:

PRaella@PRAELLALT01 /cygdrive/c/Java_ME_platform_SDK_3.0/HDCookbookEclipseWorksp
ace/HDCookbook/DiscCreationTools/security/build/classes
$ java net.java.bd.tools.security.BDCertGenerator -root 7fff0001
Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jce/
provider/BouncyCastleProvider
at net.java.bd.tools.security.SecurityUtil$Builder.build(SecurityUtil.ja
va:464)
at net.java.bd.tools.security.BDCertGenerator.main(BDCertGenerator.java:
179)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.Bounc
yCastleProvider
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 2 more

PRaella@PRAELLALT01 /cygdrive/c/Java_ME_platform_SDK_3.0/HDCookbookEclipseWorksp
ace/HDCookbook/DiscCreationTools/security/build/classes
$

billf
Offline
Joined: 2004-02-13
Points: 0

You're missing the bouncycastle package. See https://hdcookbook.dev.java.net/security_readme.html, searching for "bouncycastle".

praella
Offline
Joined: 2010-07-04
Points: 0

I do have the bouncycastle package, but may be the path wasn't set correctly. I now set it correctly, but now it gives a slightly different error:

PRaella@PRAELLALT01 /cygdrive/c/Java_ME_platform_SDK_3.0/HDCookbookEclipseWorksp
ace/HDCookbook/DiscCreationTools/security/build/classes
$ java net.java.bd.tools.security.BDCertGenerator -root 7fff0001
Exception in thread "main" java.lang.NoClassDefFoundError: net/java/bd/tools/sec
urity/BDCertGenerator
Caused by: java.lang.ClassNotFoundException: net.java.bd.tools.security.BDCertGe
nerator
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: net.java.bd.tools.security.BDCertGenerator. Prog
ram will exit.

PRaella@PRAELLALT01 /cygdrive/c/Java_ME_platform_SDK_3.0/HDCookbookEclipseWorksp
ace/HDCookbook/DiscCreationTools/security/build/classes

Where is it going wrong?

billf
Offline
Joined: 2004-02-13
Points: 0

I think the error message is telling you what's going wrong:

Could not find the main class: net.java.bd.tools.security.BDCertGenerator

Probably your path doesn't contain the JAR that has net/java/bd/tools/security/BDCertGenerator.class in it. I don't know off hand which JAR file that is, but you can just look inside the various JARs that get built until you find it.