Greg Kim

Greenhorn
+ Follow
since Jun 20, 2011
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 Greg Kim

I got it working, thanks for the help.
12 years ago
I put the file in the suggested folder. Correct me if I'm wrong, but I think I need to do something else. Right now, I'm trying to compile by starting with "goto C:\java\src>MooseGreetings.java". Then I just type "javac MooseGreetings.java".
12 years ago
I'm not sure what a stacktrace is, but I'm guessing this is it:

C:\Documents and Settings\TKim>java -classpath . MooseGreetings
Exception in thread "main" java.lang.NoClassDefFoundError: MooseGreetings
Caused by: java.lang.ClassNotFoundException: MooseGreetings
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: MooseGreetings. Program will exit.

EDIT: Oh, I understand what I did wrong here, but I'm not completely sure what I need to do.
12 years ago
I figured out what I did wrong. I made a user JAVA_HOME and a system PATH, but it's fixed now. My command prompt now recognizes the command, but I still can't compile the MooseGrettings.java example. Why is there an "src" in the file path in the example? Should I make a folder named src?
12 years ago
I just started learning Java, and right now, my main problem is that I can't compile my code. I followed the directions here: https://coderanch.com/how-to/java/how-to-create-java-program. I downloaded the x86 JDK, and I set the environment variables. When I type java -version, it shows me the version number, but when I type javac -version, it says that javac is not recognized as a command. What could be the cause of the problem?
12 years ago