Skip to main content

Package problem in java?

1 reply [Last post]
kbanerjee2002
Offline
Joined: 2006-07-18

Package problem in java?
Please help me. I have two packages named app and Util. Util is inside app. In Util i have the file BitUtils.java and in app i have CertkillerApp.java which is the driver file. I am getting error. Please help me.
BitUtils.java :

package app.util;
public class BitUtils {

public static void process(new byte[]) {

System.out.println("Inside method byte");
}
}

CertkillerApp.java
package app;
public class CertkillerApp {
public static void main(String[] args) {
byte[] bytes = new byte[256];
app.util.BitUtils.process(bytes);
}
}

D:\>javac -classpath app\*.java app\util\*.java
D:\>java -classpath D:\app app.CertkillerApp
Exception in thread "main" java.lang.NoClassDefFoundError: app/CertkillerApp

D:\>java -cp D:\app app.CertkillerApp
Exception in thread "main" java.lang.NoClassDefFoundError: app/CertkillerApp

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kbanerjee2002
Offline
Joined: 2006-07-18

D:\>javac -classpath . app\*.java app\util\*.java

D:\>java -classpath . app.CertkillerApp
Inside method byte

Solved