Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 1 of 2 12 LastLast
Results 1 to 25 of 27

Thread: Java Tutorial Problem - HelloWorldApp

  1. #1
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Java Tutorial Problem - HelloWorldApp

    "Hello World!" for Microsoft Windows (The Java™ Tutorials > Getting Started > The "Hello World!" Application)

    The above link is proving more difficult than I have anticipated, but for the wrong reasons.

    I have created my java application HelloWorldApp.java but for somereason my computer cannot recognize the Complier.

    When typing in C:\>java - version the response is

    RegistryKey 'Software\Javasoft\Java Runtime Enviroment\CurrentVersion' has version '1.7', but'1.6' is required.
    Error: could not find java.dll
    Error: could not find java SE Runtime Enviroment

    However, clearly I have on my machine - jdk6-6u26-windows-i586.

    Can anyone help me this my issue. Im sure its childs play to everyone here but I need programming experience to get into grad school.

    Any feedback will be appreciated.

    Thanks.


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    It would seem that your Java installation is borked. Try uninstalling and installing again.
    Improving the world one idiot at a time!

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Java Tutorial Problem - HelloWorldApp

    Quote Originally Posted by Junky View Post
    It would seem that your Java installation is borked. Try uninstalling and installing again.
    Urban Dictionary: borked

    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Can you explain how you got the mixed versions of java on your system?
    It looks like the java.exe file on the PATH (1.6) is not the same version as is referred to in the Registry (1.7).

  5. #5
    Member
    Join Date
    Aug 2011
    Posts
    48
    My Mood
    Fine
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Quote Originally Posted by Norm View Post
    Can you explain how you got the mixed versions of java on your system?
    It looks like the java.exe file on the PATH (1.6) is not the same version as is referred to in the Registry (1.7).
    Hi, Yes, I think the solution is to modify that registry key to 1.6 and make sure the %PATH% variable on Windows is point to correct your Java installation.

    You can type "java -version" in the command line to see which version of Java you are using.

    immutable objects
    Last edited by ha.minh.nam; December 4th, 2011 at 07:24 PM.

  6. #6
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Quote Originally Posted by Norm View Post
    Can you explain how you got the mixed versions of java on your system?
    It looks like the java.exe file on the PATH (1.6) is not the same version as is referred to in the Registry (1.7).
    I wish I could tell you. I attempted to uninstall all Java and reinstall it and I have been introduced to a new error - Error1723, which states that a dll file is missing, therefore I cannot remove it from my machine.

    So I've still been reading about computer theory but actually creating code has not happened due to this seemingly incurable error.

    any help would be appreciated.

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Sorry to hear that. Sounds like your stuck in-between here and there.
    There are tools to remove stuff from the OS. Maybe google would find something to help.

  8. #8
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Quote Originally Posted by ha.minh.nam View Post
    Hi, Yes, I think the solution is to modify that registry key to 1.6 and make sure the %PATH% variable on Windows is point to correct your Java installation.

    You can type "java -version" in the command line to see which version of Java you are using.
    how do you get the cmd prmpt to point to the root directory C:? mine is not allowing me to change it from C:users\me

    im still a absolute newcomer to programming and this has certainly done some damage lol

  9. #9
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    The cd command will change the directory. use .. to go up one level

    D:\JavaDevelopment\NormsTools>cd ..
     
    D:\JavaDevelopment>cd ..
     
    D:\>

  10. #10
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Java Tutorial Problem - HelloWorldApp

    Simply,
    D:\JavaDevelopment\NormsTools>cd
    D:\JavaDevelopment>cd
    D:\>
    This works the same way as above

  11. #11
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Can anyone help me - if i save my source code in C:\>Users\Me\Java1\file, I cannot for the life of me get the cmd prompt to that file. it always remains stuck at C:\>Users\Me

  12. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Use the cd command:
    cd Java1
    to change from Me to Java1

  13. #13
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Norm,

    Thank you for your reply - it looks very helpful. I will try your suggestion out when I get home from work. Just for some background, I am an accountant by trade and am attempting to get into grad school for Information Technology and then later Software Engineering.

    I have to take the Java course in order to be accepted into Grad School. My problems basically originate in the DOS prompt area. From what I understand, I need to have the cmd prompt pointed to the "folder" where i have my .java files saved. So that when I want to create a class file I would simply type - javac "filename".

    For the life of me, I cannot get the DOS bit down on my own. When I am in the course with the instructor, its easy, piece of cake. When I am on my own, things like this creep up on me all the time and prevent me from getting anywhere.

    More than likely Ill be back looking for more help and I appreciate all that you have done and I also appreciate the help that everyone here has given me.

    CH103

  14. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    There must be a site with some doc on DOS and the DOS commands.
    I bought a small book years ago that I still use occasionally when I write batch files. I'm on XP.

  15. #15
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    I am looking for documentation of DOS as we speak, but dont tell the boss, lol.

  16. #16
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    so I cannot even get the "Java -version" to work.

    can i type that in a root dir?

  17. #17
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    when you get errors, please copy and paste the full text here.
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

  18. #18
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Hey Norm thanks for the help!

    Ok so I am feeling alittle bit better about Java now after taking two courses so far. However, I am still running into Novice Errors. For example, in class I can compile java files into class files and I have gotten helloworld to work.

    Problem is I cant do it on my home machine, which is a huge problem.

    I think my problem is with my PATH and CLASSPATH variables. From what I understand, you need to set your PATH to the "folder" that contains the "javac.exe" file. And then you need to have the CLASSPATH set to the folder where you save your .java files at. Then, when these two settings are complete, you should be able to compile any java file you wish at any time you wish.

    So, can anyone tell me is there a way to reset all PATH and CLASSPATH settings, STRICTLY for JAVA, so I wipe out and restart?

    Also, how can I "test" the java -version and javac commands to see if they are working? what command prompt folder do I need to be at to test correctly?

    This board is awesome, I thank you all so much and do look forward to the day when I can actually contribute here!

  19. #19
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    You don't need to set the CLASSPATH variable. In fact sometimes having it set can be a problem.
    You do need the PATH variable as you have described. The PATH is used by the OS and you would NOT want to do more than add the java bin path to it. Leave the rest of it alone.

    If the command files are on the PATH you should be able to execute both java and javac in any folder when you open a command prompt window.

  20. The Following User Says Thank You to Norm For This Useful Post:

    ch103 (September 12th, 2011)

  21. #20
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    what does it mean if I can only compile in the folder where the Javac is?

    Also, what if I cant get the "java -version" and javac commands to work at any folder path?

  22. #21
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    what does it mean if I can only compile in the folder where the Javac is?
    If the OS's PATH variable does not point to the folder where the javac command is located, then the OS can only find & use the command when it is in the current folder.
    get the "java -version" and javac commands to work at any folder path
    The OS must have the path to where the commands are located to be able to find and use them.
    One way to do that is to put the path to the folder containing those commands in the PATH variable.
    Another way is to give the OS the full path the to command when you use it.

  23. The Following User Says Thank You to Norm For This Useful Post:

    ch103 (September 12th, 2011)

  24. #22
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Norm, your help has been invaluable to me. My course instructor understands that programming is new to me, but some of her reactions to my questions are amusing, if you are her, and frustrating if you are me. lol if that makes sense.

    so if my PATH environment variable is pointing to the folder with my javac I should be able to compile java files into class files at any point in the cmd prompt. and still i cannot get this to work. for all of my homework that I do, I am compiling in the folder that the javac resides in. its the only way ive been able to get it all to work right.

  25. #23
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Open the command prompt and enter the path command. It will display the environment variables' values. Here is what I get:
    D:\JavaDevelopment\Testing>path
    PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sys tem32\Wbem;C:\Program Files\Java\jdk1.5.0_04\bin;C:\BatchFiles;C:\Progra m Files\Support Tools\;C:\WINDOWS\system32\WindowsPowerShe
    ll\v1.0;C:\Program Files\QuickTime\QTSystem\
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

    Look at what is displayed to see if the path to the bin folder is there.

  26. #24
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Hi Norm, is there a way I can private message you and send you my DOS outputs? Id do it here but since the folder path contains my name, Id rather not.

    Again, your help to me is been invaluable. I only get 1 class per week, and I am really looking silly when alot of my coworkers are already developers...

  27. #25
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Tutorial Problem - HelloWorldApp

    Paste the contents of the command prompt into an editor, change the contents as you like and then copy and paste that here.

Page 1 of 2 12 LastLast

Similar Threads

  1. Which is the best place to get java tutorial online??
    By texsas12 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: September 2nd, 2012, 07:45 PM
  2. problem completing beginners' gui tutorial
    By mechnik in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 18th, 2011, 03:53 PM
  3. java ws tutorial
    By aracky in forum Member Introductions
    Replies: 1
    Last Post: July 14th, 2010, 03:12 AM
  4. an easy clear java programming tutorial
    By zkil_jpf in forum The Cafe
    Replies: 2
    Last Post: April 22nd, 2010, 08:40 AM
  5. [SOLVED] Problem with a tutorial program(Adding the answer of two squared numbers together)
    By Melawe in forum What's Wrong With My Code?
    Replies: 20
    Last Post: April 7th, 2010, 09:03 AM