Travis Rademacher

Greenhorn
+ Follow
since Jul 05, 2010
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 Travis Rademacher

Woops, yes those are quotations. Okay I think it is just for spacing it out because I haven't gotten far enough into my book for debugging yet.
11 years ago
Often when reading my java book and when their code wants to display an output, the statement will look something like this:

System.out.println(x + "" + y +" ") ;

I just don't get why those parenthesis are there. If I am already asking the JVM to print the following output on the command line, why do I need to act as if it should be printing more. Would it work if the code looked something like this:

System.out.println(x + y ) ;

What is the difference between the two of these?
11 years ago
Thank you christophe. My code works fine now
11 years ago
What I did was:

java -cp <c:\java> MyFirstApp

It told me access is denied. I am system administrator so this confuses me.
11 years ago
Thank you so much. I have another problem. I compiled the source file fine. Now I tried to run the class file. In command prompt, I typed: java c:\java\myfirstapp.class

It gave me a message:
Exception in the thread "main" java.lang.NoClassDefFoundError: c:\java\myfirstapp/class

Caused by: Java.lang.ClassNotFoundException: C:\java\myfirstapp.class
at:

And then a bunch of stuff


This is my source file:

public class MyFirstApp {

public static void main (String[] args) {
System.out.print("JAVA!!!"); }
}


Is it an error in my programming or what?
11 years ago
I wrote down CLASSPATH and PATH in my system variables already.
The CLASSPATH's value is %classpath%;. And the PATH's value is %path%;C:\Program Files\Java\jdk1.6.0_20\bin

I'm not sure if there are any errors in that above, so I just included it.
After this, created my source file, saved it in C:\Program Files\Java\jdk1.6.0_20\bin as MyFirstApp.java. So I open command prompt, enter: javac MyFirstApp.java

This is what comes up:

javac: file not found: MyFirstApp.java
Usage: javac <options> <source files>
use -help for a list of possible options

Help?


11 years ago