Results 1 to 12 of 12
Thread: Issues With Config??
- 11-01-2012, 11:40 PM #1
Member
- Join Date
- Nov 2012
- Posts
- 8
- Rep Power
- 0
Issues With Config??
I am reading Sam's Teach Yourself Java as an introduction to the basics of Java coding. I have just downloaded the JDK7u9\jdk1.7.0_09 development kit and working the intitial task of writing, saving and running a simple text program. I store all of the new Java files on an external hard drive (F). I have set the Path in enviroments, saved the code as a .java file but when I try to compile the file I get errors.
Here is the code I wrote
class Saluton {
public static void main(String[] arguments) {
String greeting = "Saluton mondo!";
System.out.println(greeting);
}
}
Here is where I set the Path
Here are the command prompt attempts to open and/or compile
Here is the way it was originally saved
I am following the book to the letter so do not understand where I am having the promblem. The only thing that worked right was the version check which confirms the version that is on drive "F". The version on drive "C" is different and not the one I am using for coding.
Any help will be much apreciated.
Thanks, Spin
- 11-01-2012, 11:44 PM #2
Re: Issues With Config??
You can't just CD to another drive. Try using F: first, and then CD F:\etc.
- 11-01-2012, 11:48 PM #3
Re: Issues With Config??
The issue is they are attempting to CD to a Java file and not the directory containing the java file.
- 11-02-2012, 12:02 AM #4
Member
- Join Date
- Nov 2012
- Posts
- 8
- Rep Power
- 0
Re: Issues With Config??
I can't change the C:\Users\Mike Mullen part. It has been on this comp since Ive owned it and I cannot get rid of it. I am not trying to CD "TO" F:, I am tryiong to open a file that is contained on drive "F". I have tried accessing the directory file in every way I know. Im not sure what you guys are seeing that I am not. The guide clearly states that to open a saved file type the following CD C:\filename Since my files are on another drive it would sem logical to me to type CD F:\filename.
I can relate to what TOLL is saying but again I am doing that. I believe the first command for C: is messing it up although I dont get the error if I type the entire path through each folder.
- 11-02-2012, 12:07 AM #5
Re: Issues With Config??
CD is the change directory comman and has nothing to do with opening a file. What do yo mean by "opening"? Viewing the file in a text editor or actually running the Java program?
Anyhoo, what you need to do is change to the directory containing your .java file. Compile the Java program by typing: javac MyProgram.java
If there are no errors/problems then MyProgram.class file should be created. Do a ls command to confirm. Then run by typing: java MyProgram
- 11-02-2012, 12:13 AM #6
Re: Issues With Config??
Did you try to just use F: instead of CD F:? Because unless you can get to the correct folder in your command prompt, it will be a lot harder.
And no, C:\Users\Mike Mullen is not messing it up. It's just the default folder. For instance, try to CD \ and you should instead see C:\> (assuming the correct privileges and whatnot).
- 11-02-2012, 12:16 AM #7
Member
- Join Date
- Nov 2012
- Posts
- 8
- Rep Power
- 0
Re: Issues With Config??
This is one page in the book I am reading, it discusses opening and creating folders
Sams Teach Yourself Java 2 in 24 Hours | Configuring the Software Development Kit | InformIT
As for the directory that holds the .java file, they are listed in the example above. Path as such F:\JAVA Development\Java24work\Saluton.java
I understand file paths but I am obviously missing any other meaning of the word directory as I have tried to compile the Saluton.java file exactly as you have described and it tells me that javac is not recognized.
- 11-02-2012, 12:18 AM #8
Member
- Join Date
- Nov 2012
- Posts
- 8
- Rep Power
- 0
- 11-02-2012, 12:20 AM #9
Re: Issues With Config??
If you are getting the javac is not recognized error then you have not update your path correctly. One thing to note is that if you have a command window open before making changes to the path it will not see those changes. You must close the command prompt and re-open after changing the path.
- 11-02-2012, 02:29 AM #10
Member
- Join Date
- Nov 2012
- Posts
- 8
- Rep Power
- 0
Re: Issues With Config??
Ok, The path is entered like this
F:\jdk1.7.0_09\bin It is my understanding that this should allow the javac and any other files in the bin folder to be findable by the program. This is not happening.
I closed the command window and reset the path, this did not work. I am using a guide from I believe 2003 so I am now of the opinion that the book and the latest JDK are not on the same page. Is there a better instructional book for the fundamentals of using JDK 7u9.Last edited by Spindraft; 11-02-2012 at 02:32 AM.
- 11-02-2012, 03:00 AM #11
Member
- Join Date
- Mar 2011
- Posts
- 44
- Rep Power
- 0
Re: Issues With Config??
ok, I may have this all wrong,
but java appears to be installed ok.
When you typesd java -version you received a result.
So the installation is ok.
I think what you are after is the following:
javac F:\JAVA Development\Java24work\Saluton.java
It may be easier to actually type the following tho:
F:
cd JAVA Development\Java24work
** I'm not sure how it will deal with spaces between words tho.
and from here just type java blah blah or javac blah blah.
Hope that helps.
- 11-02-2012, 03:05 AM #12
Member
- Join Date
- Nov 2012
- Posts
- 8
- Rep Power
- 0
Re: Issues With Config??
Thanks sibernewf, I thought about putting javac in front of the F: but it just seemed like a really wierd thing to do. If it keeps up after that I will get rid of the spacing in file names.
Tried the above suggestions and still no luck. I am running a version with NetBeans built in so I searched for a better intro book for beginners.
Here is the link http://www.homeandlearn.co.uk/java/java.html
They are using JDK 6 with NetBeans as the main editor and it works great. I can even call up and run programs with the command prompt with zero issues. Looks like a pretty good starting place for newcomers to JAVA Programming.
Thanks for all the help everyone.Last edited by Spindraft; 11-02-2012 at 04:39 AM.
Similar Threads
-
structs config file
By gani in forum StrutsReplies: 2Last Post: 07-11-2012, 09:41 AM -
Struts.config problem
By legolad in forum StrutsReplies: 0Last Post: 05-31-2012, 05:41 PM -
tools4j-config
By java software in forum Java SoftwareReplies: 0Last Post: 02-05-2012, 05:56 PM -
Tomcat 5.0 and struts-config.xml
By ajeeb in forum Advanced JavaReplies: 1Last Post: 06-07-2009, 04:53 PM -
struts-config.xml
By Heather in forum Web FrameworksReplies: 2Last Post: 01-17-2008, 11:23 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks