• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Where do I begin?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy people,

I am a Java noob; just bought " Head First Java" and there I found instructions to download Java 2 Standard Edition SDK + API Documentation. In addition, I need to create a path to the Bin directory?

Questions:
1. I cannot find the API documentation - could you please share a link to it?
2. What do I need to do with creating that path; this is entirely unclear to me?

Thank you in advance.

Gil
 
Ranch Hand
Posts: 954
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can download sdk 8 from here

You can set the path by following this tutorial.
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can find the API documentation here but it's pretty daunting for a beginner. (BTW, Google is your friend. Type "java api docs" and you usually get what you want.)
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

We have an FAQ which should help; it includes setting the PATH. You link to the documentation here.
 
Ranch Hand
Posts: 89
Python C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I actually did download the Java API docs but I don't have a clue how to use them offline..I always end up going to the online docs. Can anyone please explain to me how to use the offline docs?
Thanks!
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ashwin Rao wrote:I actually did download the Java API docs but I don't have a clue how to use them offline..I always end up going to the online docs. Can anyone please explain to me how to use the offline docs?
Thanks!


I'm assuming you have Windows.

  • Unzip docs
  • In Folder Explorer, find docs\api\index.html
  • Right-click on index.html and send to Desktop


  • You now have a shortcut on your desktop that points to the index of the API docs.
     
    Campbell Ritchie
    Marshal
    Posts: 79177
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The docs are the same so you might only need an offline copy if you are working offline a lot.
     
    Ashwin Rao
    Ranch Hand
    Posts: 89
    Python C++ Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Inside the api folder I do not have index.html I have the following folders:

    java
    javax
    org
    resources
     
    Knute Snortum
    Sheriff
    Posts: 7125
    184
    Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Do you have an index.html file anywhere? What happens when you click it?
     
    Campbell Ritchie
    Marshal
    Posts: 79177
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Did you download the documentation? Have you unzipped it into a docs folder?
     
    Gil Levy
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thank you all for your answers.

    I allow myself to continue with some other Noob questions:
    1. What do I need documentation for?
    2. Where do I write my first script? - on notepad? (first code = a small example from a text book)
    3. How can open a compiler once I have written my first code?

    Thank you very much in advance.
     
    Ranch Hand
    Posts: 243
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    This FAQ should help you out.
     
    Gil Levy
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thank you:)

    It reads: "Also be careful that your editor does not append the ".txt" extension to your file. Some filthy editors like Windows Notepad may do it, but Notepad is probably not your favorite editor !"
    Which editor should I use than?
    I am a Windows 8.1 user.
     
    Campbell Ritchie
    Marshal
    Posts: 79177
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Have a look at this old post, and look at the write backwards link, and look at our FAQ. If I ever use Windows my favourite is called Notepad++. You can download it free of charge; I think it is open source. Link in the FAQ. Note that the options I suggested you turn on will help you no end. Some people may need to change the colours for syntax highlighting to make them easier to read.
     
    Gil Levy
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Many thanks. I appreciate your patience and assistance.

    I downloaded Notepad++ and going to read the FAQ.

    I probably come back with some few more questions.

    Cheers
     
    Gil Levy
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I would like to run the sample code from FAQ
    ***********************************************
    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.

    C:\Users\Gil>
    C:\Users\Gil>
    C:\Users\Gil>\java\src MooseGreetings.java
    '\java\src' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Gil>
    C:\Users\Gil>
    ************************************************
    But I get this screen - what am I doing wrong? how should I tackle it?
     
    author
    Posts: 23951
    142
    jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Well, you are trying to execute a program named "src", that is supposedly in the "\java" directory, and the operating systems is saying that that program doesn't exist. BTW, what are you trying to do?

    Henry
     
    Campbell Ritchie
    Marshal
    Posts: 79177
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Doesn't it say what to do in the FAQ?
    Navigate to the directory, then compile then execute:-

    cd \java\src
    javac MooseGreeting.java
    java MooseGreeting

    I may have spelt the name of the Moose program wrongly.
     
    Gil Levy
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I am trying to practice this example:

    Creating your first Java program

    This is where the fun begins ! Let's create a simple greetings class. Use your favorite text editor to create a new file. You don't need any advanced IDE like Eclipse or IntelliJ yet. For the moment, stick to the editor you're used to. Copy/paste the following code in your editor :


    public class MooseGreetings {
    public static void main(String[] args) {
    System.out.println("mooooooooooo");
    }
    }

    Save the file in the directory of your choice. But do not save it under the JDK install directory. Instead, save it in a directory where you'd like to keep your java sources in. For example, C:\java\src. Name the file MooseGreetings.java. Be extra careful with the uppercase and lowercase. The filename must match exactly the name of your class. mOoSegReeTings.java won't work. Also be careful that your editor does not append the ".txt" extension to your file. Some filthy editors like Windows Notepad may do it, but Notepad is probably not your favorite editor !

    Compiling and executing the program

    (For Mac-specific instructions, go to https://coderanch.com/t/111632/Mac/JAVA-MAC-OS)

    At the command prompt, go to the directory where you have saved the MooseGreetings.java file. Type "javac MooseGreetings.java", and press the enter key.

    C:\>cd \java\src
    C:\java\src>javac MooseGreetings.java
    The class should be compiled, and a new file called MooseGreetings.class should be created in the same directory. If a compiler error happens, make sure you copy/pasted the above code properly. If the file is not found, make sure you're in the right directory, and that your file is properly named MooseGreetings.java. If you can't figure out why it does not compile, ask at the Beginner Java forum.

    Let's execute the program. In the same directory, type the following command : "java -classpath . MooseGreetings".

    C:\java\src>java -classpath . MooseGreetings
    mooooooooooo
    C:\java\src>
    Greetings for the Javaranch Moose should be printed : mooooooooooo.

    That's it ! You've successfully executed your first Java program. You're now ready to get into the Java world ! If you have any questions, some friendly folks will be happy to help you at the Beginning Java forum.
     
    Knute Snortum
    Sheriff
    Posts: 7125
    184
    Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    What problems are you getting? What specifically went wrong?
     
    Gil Levy
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Now I get a message. Access Denied.

    I'm lost. Any ideas what I need to do?


    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.

    Directory of C:\Users\Gil

    05/09/2015 16:53 <DIR> .
    05/09/2015 16:53 <DIR> ..
    04/11/2015 14:03 0 agent.log
    04/13/2015 09:17 <DIR> Contacts
    05/09/2015 12:26 <DIR> Desktop
    04/13/2015 09:17 <DIR> Documents
    05/09/2015 12:25 <DIR> Downloads
    04/13/2015 09:17 <DIR> Favorites
    04/13/2015 09:17 <DIR> Links
    05/09/2015 16:53 0 MooseGreetings.java
    04/13/2015 09:17 <DIR> Music
    05/09/2015 09:14 <DIR> OneDrive
    04/13/2015 09:17 <DIR> Pictures
    04/13/2015 09:17 <DIR> Saved Games
    04/13/2015 09:17 <DIR> Searches
    05/08/2015 18:53 <DIR> Videos
    2 File(s) 0 bytes
    14 Dir(s) 421,413,548,032 bytes free

    C:\Users\Gil>cd C:\

    C:\>java\src>javac MooseGreetings.java
    Access is denied.

    C:\>
     
    Gil Levy
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I think there is something fundamental that I'm failing to understand.

     
    Knute Snortum
    Sheriff
    Posts: 7125
    184
    Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    what happens when you type

    C:\>javac -version
     
    Gil Levy
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I get this:


    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.

    C:\Users\Gil>cd c:\

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

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

    c:\>
     
    Knute Snortum
    Sheriff
    Posts: 7125
    184
    Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    You probably need to edit your PATH variable.
     
    Gil Levy
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Ok, I will check that.
    I recall that I followed the instructions for Windows 7 but I have windows 8.1 - is that similar set up for both versions?
     
    Knute Snortum
    Sheriff
    Posts: 7125
    184
    Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Gil Levy wrote:I recall that I followed the instructions for Windows 7 but I have windows 8.1 - is that similar set up for both versions?



    I believe so. Say, did you download the JDK? You need to developer kit to compile java. If you get the same error running javac again, I'd download the JDK again.
     
    Gil Levy
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I think I did. I will re-check that i followed the instructions correctly.
     
    Gil Levy
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    This is how i set it the path up...what's wrong?
    (see image)
    20150509_javaSetUp.jpg
    [Thumbnail for 20150509_javaSetUp.jpg]
     
    Knute Snortum
    Sheriff
    Posts: 7125
    184
    Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I'm not sure what's wrong, but I would download the latest JDK, install it, and change your JAVA_HOME variable to reflect that. Java 1.5 is very old.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic