Reegan Cantrelle

Greenhorn
+ Follow
since Aug 30, 2016
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Reegan Cantrelle

*sigh*. Never mind, I've figured it out. Apparently needed to close out command prompt for the change to take effect. Thanks for the help, it is much appreciated.
8 years ago
I've tried following the path setup settings and it is giving me the same result; I tried that solution before posting (just tried it again for the sake of it). I can clearly see the javac.exe file in the bin folder..? Is there any other reason this wouldn't be working? It also can correctly access the java.exe file so I'm confused since they are in the same folder location.
8 years ago
Hi, I've just gotten a new computer and am redownloading all of my required coding software. I've just downloaded the Java SE 8u102 download, and when I go to the command prompt to insure that things are working I receive an error:

C:\Users\reega>java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

C:\Users\reega>javac -version
'javac' is not recognized as an internal or external command,
operable program or batch file.

I was under the assumption that these two items came bundled together? Javac is the compiler, correct? So if one is not working shouldn't they both be working? Sorry if this is a stupid question, tend to have more issues when installing software than I do with actual coding. Thanks for any help!
8 years ago

Dave Tolls wrote:Java maps package names to folders.
So package foo.bar will be in a folder on the classpath called foo/bar.

This also means that, when executing or compiling, the classpath should include the root directory (or directories, since there may be more than one) for your packages.
In your case that root would be the Head-first-java-master folder.



Thanks for the quick reply. Can you provide the exact syntax for how I would type this into the terminal? I'm still a bit confused on it. I'm assuming you're meaning that it should be included somewhere on the "java -classpath . BeerSong" line. And for the root directories, how far back do you go? Currently the file is buried within three folders on the desktop (folder "chap01" inside folder "head-first-java-master" inside folder "coding").
8 years ago
Apologies for the screenshot, figured out how to copy/paste from the command prompt now

Can someone explain packages to me? I ran a sample of code from my book, a simple program called "BeerSong". In the source code it includes "package chap01;" before the class begins (this is also the name of the folder that the file is located in, if that makes a difference). However, when I go to run the code I get the following error:


C:\Users\reega_000>cd\

C:\>cd \Users\reega_000\Desktop\Coding\Head-First-Java-master\chap01

C:\Users\reega_000\Desktop\Coding\Head-First-Java-master\chap01>javac BeerSong.java

C:\Users\reega_000\Desktop\Coding\Head-First-Java-master\chap01>java -classpath . BeerSong
Error: Could not find or load main class BeerSong


I can get the program to run fine if I go into the source file and remove the package statement at the beginning. What is the cause of this?
8 years ago
Here's the end result. As an aside question, do you believe there is significant value in learning to code from the command prompt/notepad without using an IDE? I suppose it has something to do with learning to crawl before learning to walk; however I wasn't sure if there was more to it than that.
8 years ago
I've gotten it now; it was as I thought, a simple error for lack of knowledge of the command prompt. I was incorrectly using the cd command to navigate to the correct directory where my files were stored. Hopefully now I can get through the introduction of the book at least before encountering more errors.
8 years ago
Perhaps my confusion is coming from how to use the command prompt (my limited coding experience was all done using IDEs). I'm trying to follow along with the "mooooooooo" program however I keep getting "... is not recognized as an internal or external command, operable program or batch file."

I am storing my text files in a folder that is located on my desktop, I am unsure if this makes a difference or not.

(On another note, I appreciate the continued assistance as I will likely be a frequenter of these forums for quite a while until I get a grasp on things).
8 years ago
This was my results:
8 years ago
So I've recently decided I would like to begin android app programming. I've been advised to begin by familiarizing myself with Java. The first book I'll be going through on the subject is "Head First Java" (second edition). I'm already somewhat lost at the beginning.

It requires me to download the java SDK, the API documentation, and to "add an entry to your PATH environment variable that points to the /bin directory inside the main java directory". I am fairly certain that I already have the newest SDK (I believe I downloaded it when I downloaded the android development tools), though I am unsure about the API documentation and the entry to the path environment variable bit.
8 years ago