Rodney Knight

Greenhorn
+ Follow
since Sep 12, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rodney Knight

Originally posted by marc weber:
[QB][/QB]



OK. The classpath does not exist either in the User or System variables. The CLASSPATH that came from the echo command above yielded a directory that would have been set when I tried using NetBeans... that was the only place I ever typed that path in.

UPDATE::: I uninstalled NetBeans adn then Re-installed it and the CLASSPATH was reset. I did the ECHO and and it only return %CLASSPATH%. I ran my simple program and it ran w/o the '-cp .' in the command line.

I'll not use NetBeans until I understand more about what is going on.

Thanks for all the help.
[ September 12, 2007: Message edited by: Rodney Knight ]
16 years ago

Originally posted by Jesper Young:

Are you sure? What do you see if you type the following command in a command prompt window:

echo %CLASSPATH%

If you don't have CLASSPATH set and you're using Java 5 or newer, then Java should automatically look in the current directory for classes and the "-cp ." should not be necessary. I suspect that you do have the CLASSPATH variable set somewhere, even though you think you haven't.



This returned a path for a test folder I set on the desktop. Obviously I set it somehow, how would I correct that, or delete it, or reset it to the original setting?

Thanks for all the help.
16 years ago

Originally posted by marc weber:

Make sure there's a space between -cp and the dot.

(Also, check the spelling: "Shuffle1" vs. "Shuffel1".)

[ September 12, 2007: Message edited by: marc weber ]



Thanks. That worked. So, since it worked, how do I fix the problem so that I don't always have to type the '-cp .'? I don't have a CLASSPATH in my envionmental variables. I typed the name wrong in the email only, it was the '-cp .' that worked.
[ September 12, 2007: Message edited by: Rodney Knight ]
16 years ago
yes, Shuffel1.class is a file in the directory where I am trying to run the program from. That file is created after compiling, correct? The code compiles with no errors. I tried the "java -cp. Shuffle1", but that gave me:

Unrecognized option: -cp.
Could not create the Java virtual machine.

I am using Windows XP Professional 2002 SP2 and we installed the jdk1.6.0 download from Sun on Monday.
16 years ago
I am extremely new to Java.... I have type in some of the code examples I have and always get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError

I googe this and got some things about setting my classpath and so on, but I really have no idea what that menas. Any help would be appreciated.

The code I have tried is:
class Shuffel1 {
public static void main (String []args) {
int x=3;
while (x>0) {
if(x>2) {
System.out.print("a");
}
x=x-1;
System.out.print("-");
if(x==2) {
System.out.print("b c");
}
if(x==1) {
System.out.print("d");
x=x-1;
}
}
}
}
16 years ago