Eric Rounding

Greenhorn
+ Follow
since Jan 26, 2012
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 Eric Rounding

All three of the above were true.

I amended enironment variables:

Classpath
C:\Program Files\Java\jre6\bin

PATH
C:\Program Files\Java\jdk1.6.0_30\bin

And all my class files are able to be run now.

perhaps it was that I had set up the compiler but not the interpreter (to run) perhaps. Does one of the above refer to the compiler and one refer to the interpreter?
12 years ago
Hi guys,


javac com\scjaexam\tutorial\GreetingsUniverse.java



this code was what I needed. Upon seeing this everything fell into place.

Thank you both very much for the help, greatly appreciated. I've understood how to compile and run in cmd now.
12 years ago



I type: java -cp . Bun

I get:
Exception in thread "main" java.lang.NoSuchMethodError: main
12 years ago
My understanding so far is that:
-cp tells the compiler where to find class files
-sourcepath tells the compiler where to find source files
-d tells the compiler where to write the class file too. -d is effectively a manual way to package. If the .java file includes a package then the -d path is done first and then the package location is created after. the -d option doesn't create directories but utilises directories already there.

Now i think there may be something wrong with what I'm trying but the SCJA book hasn't revealed it to me, nor google pages, nor youtube tutorials.

I type javac -sourcepath com\scjaexam\tutorial GreetingsUniverse.java

and i get Javac: File Not found: GreetingsUniverse.java


Also thank you for your replies too Jeff - it is true that I may be doing the same things wrong but I am honestly trying to figure out what I'm doing wrong.
12 years ago
I type: java GreetingsUniverse.class

Error:
Exception in thread "main" java.lang.NoClassDefFoundError: GreetingsUniverse/class
Caused by: java.lang.ClassNotFoundException: GreetingsUniverse.class
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown source)
Could not find the main class: GreetingsUniverse.class. Program will exit.
12 years ago
Hello,
I am trying to run a java file from command line and i get a lang error.

My environment variable is set:

Classpath
C:\Program Files\Java\jre6\bin

Why is the error happening?
12 years ago
I have my GreetingsUniverse.java file in com\scjaexam\tutorial

So why is: javac -cp com\scjaexam\tutorial\ GreetingsUniverse.java
not causing the java file to compile?
The response is: javac: File Not found GreetingsUniverse.java

Could someone give me the exact line I would need to type to get GreetingsUniverse.java to compile when 1) My current directory is TEST, and 2) the GreetingsUniverse.java file is in TEST\com\scjaexam\tutorial.

I am currently unable to understand why javac is not seeing the file when i type the above line.
12 years ago
Hi all, hope your well.
I'll give a little groundwork first:
I have a file called GreetingsUniverse.java in TEST\com\scjaexam\tutorial

Now, if my current directory is the tutorial directory I can run the .java file by typing javac -d . GreetingsUniverse.java and it compiles fine.

My question is: If my current directory is the TEST directory. What command do I type to run the GreetingsUniverse.java file?
javac -d com\scjaexam\tutorial\GreetingsUniverse.java gives the error javac: "not a directory" - (this I do not understand)
javac -cp com\scjaexam\tutorial\ gives the error javac: "no source files" - (I understand the sentence, but I do not understand why it's saying it)

Is anyone able to answer the question above and elaborate on anything they think I should know. Or any places online that I can seek tutorials on the matter - doesn't matter how in depth or how long, time is not important knowledge is important.

Thank you in advance to any helpers, much appreciated.
SuperMagicLunchBox.
12 years ago