English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have this program I was given to work on in my class. I have no idea what any of it means, because they just wanted me to get used to the javac and java comands. I have saved my program "Limits.java" and compiled it so that I have "Limits.class". They are both in the path "C:\Documents and Settings\owner\.jedit\". When I try to do the java comand in my prompt, I get an error "Exception in thread "main" java.lang.NoClassDefFoundError... Limits/java" in my command prompt. I am in "C:\Documents and Settings\owner\.jedit>" on my command prompt. Do I have to set the class path, because I think I changed it in environmental variables when I was trying to get the path set for javac by accedent. If that has nothing to do with my problim just ignore it. Always beter to have too much information than not enough.

2007-02-07 05:58:27 · 6 answers · asked by Michael M 4 in Computers & Internet Programming & Design

I have also entered java Limits and I stell get the error. I have alos set the class path in the environmental variables to be C:\Program Files\Java\jdk1.6.0\bin and I still get the same error. I am in the C:> derectory for my comand prompt. Ok so my program is below.

/* Limits.java: Determine machine percison */
public class Limits
{ public static void main( String [] args)
{ final int N=60;
int i;
double eps=1.0, one_Plus_Eps;
for (i=0; i { eps = eps/2.;
one_Plus_Eps=1.0+eps;
System.out.println("one+eps="+ one_Plus_Eps + "eps =" +eps); }
}}

2007-02-07 06:19:18 · update #1

6 answers

Looks like you need the main class

public static void main(String [] args)
{
}

You have to have this in every java program.

If my memory serves me correctly.

RJ

2007-02-07 06:04:07 · answer #1 · answered by Anonymous · 0 0

Show us the command line you are using. It isn't finding your class. It could be that you need to set the CLASSPATH (-cp), but if you've typed the error message correctly, I think you typed in the command wrong.

You want something like this:

java Limits

not "java Limits/java" or "java Limits.java" or "java Limits.class"

2007-02-07 06:07:59 · answer #2 · answered by sspade30 5 · 0 0

You typed in command wrong:
This is what you typed:
java Limits.java
This is supposed to be the command:
java Limits

There is no .java or anything after and including . with java command

2007-02-07 06:10:03 · answer #3 · answered by Andy T 7 · 0 0

Michael you already know the answer to your problem... Yes its the classpath which you have to correct... change it to C:\\bin;.;

and it will be ok

2007-02-07 06:06:33 · answer #4 · answered by wicked_sunny 2 · 0 0

also make sure the casing of the class name within your Limits.java file is

the same

2007-02-07 06:06:09 · answer #5 · answered by AvidBeerDrinker 3 · 0 0

change <= in all the loops to < and it may work

2016-03-29 09:39:19 · answer #6 · answered by ? 4 · 0 0

fedest.com, questions and answers