0

Hi, Im new in this forums looking for an answer for my problem, I find a similar post here so I decided to suscribe here because this website look very professional.

I had the following code:

public class Gen {

	public static void main(String[] args){
		args = new String[6];
		args[0]="0101";
		args[1]="1";
		args[2]="10.10.2.66";
		args[3]="TestDB";
		args[4]="root";
		args[5]="";
		preLoad(args, null);
		System.out.println(errors);
	}
....

My error happens when I run my class file,

[root@localhost classes]# java Gen
Exception in thread "main" java.lang.NoClassDefFoundError: Gen
Caused by: java.lang.ClassNotFoundException: Gen
        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:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: Gen.  Program will exit.

I dont know why, but I run the same file on a windows enviroment using JCreator and it runs perfectly, what should be wrong?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by ardn0001
0

yes ...hmm thankyou I found an alternative code javac -d $CLASSPATH Gen.java

Edited by Reverend Jim: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.