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.

Results 1 to 16 of 16

Thread: I have no clue what is wrong

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Unhappy I have no clue what is wrong

    my path for javac is set to C:\Program Files\Java\jdk1.7.0\bin which is the default. I wrote out the Hello world program from my new book. its path is c:\document and settings\user\My Documents\myJavaPgms I cannot get the javac to run the file. Any guesses?

    I tried it both of these ways....

    C:\Documents and Settings\user>cd my documents\myJavaPgms

    C:\Documents and Settings\user\My Documents\myJavaPgms>javac Hello.java
    Error: Could not find or load main class com.sun.tools.javac.Main

    C:\Documents and Settings\user\My Documents\myJavaPgms>cd C:\Program Files\Java\
    jdk1.7.0\bin

    C:\Program Files\Java\jdk1.7.0\bin>javac Hello.java
    javac: file not found: Hello.java
    Usage: javac <options> <source files>
    use -help for a list of possible options


  2. #2
    Junior Member
    Join Date
    Dec 2012
    Location
    Okahoma, US
    Posts
    18
    My Mood
    Grumpy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I have no clue what is wrong

    Did you put in your environment variable?

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: I have no clue what is wrong

    Yep...

    C:\Documents and Settings\user>path
    PATH=C:\Program Files\AMD APP\bin\x86;C:\WINDOWS\system32;C:\WINDOWS;C:\WIND OWS\
    System32\Wbem;C:\WINDOWS\system32\WindowsPowerShel l\v1.0;C:\Program Files\Common
    Files\Roxio Shared\DLLShared\;C:\Program Files\ATI Technologies\ATI.ACE\Core-St
    atic;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.7.0\bin

  4. #4
    Junior Member
    Join Date
    Dec 2012
    Location
    Okahoma, US
    Posts
    18
    My Mood
    Grumpy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I have no clue what is wrong

    Here's a tutorial to make sure you did the correct steps..
    Java Tutorial: Java For Beginners (Part 1): Getting Started - YouTube
    and you can skip to part 1:30 to installing env. variable part, since you already have

  5. #5
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: I have no clue what is wrong

    OK Shzylo,

    I uninstalled Java and completed the process exactly how it was done in the video and I am still receiving the same error.

    Any other suggestions?

  6. #6
    Junior Member
    Join Date
    Dec 2012
    Location
    Okahoma, US
    Posts
    18
    My Mood
    Grumpy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I have no clue what is wrong

    Hmm..

    can you give some screen shots?
    You can search "snipping tool" and it will allow you to select a part of your screen, and save it as an image. Do that with your environment variable.

  7. #7
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: I have no clue what is wrong


  8. #8
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: I have no clue what is wrong

    Any other ideas?

  9. #9
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: I have no clue what is wrong

    1. Can you please put here your Hello.java file , just to see the code


    2. Also take the "commad prompt" and type the following command

    javac -version

    Check that the command prompt display you the java version as below eg ;


    "javac 1.7.0_05"

  10. #10
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: I have no clue what is wrong

    1. public class Hello
    {
    public static void main(String[] args)
    {
    System.out.printIN("Hello, world!");
    }
    }

    2. When i did the version it came up with
    Javac 1.7.0_10

  11. #11
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: I have no clue what is wrong

    Hi ,
    There is one error in your code. Check Line number 5
    Wrong usage of print statement, you should use "println" and not printIN

    Please correct the above mentioned error and try it !!! This should work without any issues.

  12. #12
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: I have no clue what is wrong

    Thanks mike
    I changed that line but it still will not work.

    It still gives me the error: Could not find or load main class com.sun.tools.javac.Main

    Still not sure what the problem is. I may try to install Java on another computer. Any more ideas?

  13. #13
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: I have no clue what is wrong

    Now i even tried using my notebook to do it and I am still getting the same error messages. Maybe i need to find an older build?

  14. #14
    Member vigneshwaran's Avatar
    Join Date
    Nov 2012
    Location
    Chennai, TamilNadu
    Posts
    35
    My Mood
    Cheerful
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: I have no clue what is wrong

    create an account in Oracle | Hardware and Software, Engineered to Work Together first, then login to that site, paste this link in address bar and download jdk1.7.0 for windows-64 (for 32 bit OS) or windows-86(for 64 bit OS) by clicking the radio button "Accept Licence Aggrement" which you can see at there.

    Java SE Development Kit 7 Downloads

    then install newly. ok.. finally set the path, by typing on the command prompt as like the instructions given below. Before starting to do the following steps now see the "java" folder under c:\program files
    and now navigate to till bin directory and when you open that bin folder you see many jar files and application files. check javac and java files are there.. now right click it and choose properties then copy its location.. it will be like c:\program files\java\jdk some thing and finally ends with bin..
    now click
    Start-> Run
    Type: cmd
    then just type as
    set path=""
    right click by ensuring the cursor within the double quotes and paste the location which you have copied within that double quotes.
    now you run the program here..


    Sorry for Spoonfeeding..

  15. The Following User Says Thank You to vigneshwaran For This Useful Post:

    Java_noob333 (December 22nd, 2012)

  16. #15
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: I have no clue what is wrong

    Thank you very much. Not sure why that worked but it does.

  17. #16
    Member vigneshwaran's Avatar
    Join Date
    Nov 2012
    Location
    Chennai, TamilNadu
    Posts
    35
    My Mood
    Cheerful
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: I have no clue what is wrong

    does the java and javac working properly?


    then fine. thank you
    R.R. Vigneshwaran..

Similar Threads

  1. What wrong?
    By bumbar in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 21st, 2012, 11:06 AM
  2. Re: What wrong?
    By rajesh_rasu26 in forum Java Theory & Questions
    Replies: 1
    Last Post: September 21st, 2012, 11:03 AM
  3. what wrong with this??
    By sephskie in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 14th, 2012, 07:50 PM
  4. Swing Dialog Boxes --- Have no clue why its not working
    By jap2008 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: November 18th, 2010, 04:20 PM
  5. What's wrong?!
    By deeerek in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 22nd, 2010, 07:11 PM