Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java beginning

 
Goran Dre�njak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I instal jdk what is next step?
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you wish to do?

Does this help you? http://www.jibble.org/settingupjava.php
 
Goran Dre�njak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want compile programs in cmd!
 
Chris Beckey
Ranch Hand
Posts: 116
Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sun has really good tutorials, starting from where you are. See:

Java Getting Started Tutorial
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to follow the instructions in the link I posted.

When you have installed JDK and updated your PATH try to
open a command prompt (DOS, xterm ect.) and type
"java" and "javac".

If you've set the path correct you wont get a message
a la "java is not a regocnized command or filename".

To compile a Java file do the following:
1) create a file, e.g. Hello.java
2) open the file and start typing java code, e.g.

3) goto the directory that contains the file you created
4) type "javac <filename>", e.g. javac Hello.java
the file will then be compiled and a class file will be
generated which can be executed.
5) If the file compiled without errors type: "java File",
e.g. "java Hello" which should print "Hello World".

/Svend Rost
 
Goran Dre�njak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I see that tutorials but they dont help mee!
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you finding difficult? If you can't understand any of the tutorials, you might have a problem. If there are certain parts of the turorials you don't understand, feel free to ask quesitons about them here. Someone will probably help. Or if you are stuck with something not mentioned in the tutorials, post a question about that and someone is liable to help.
 
Goran Dre�njak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem is on cmd!
I instal java then I create file hello world, but I dont now how to set path and Svend told me type "javac<filename>" , where I shoud type this?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah so it is an OS problem, not a Java problem. I'll assume since you mention cmd that you are using Windows. You will need to make sure that you JDK/bin directory is in your PATH. This is how Windows finds executables to run. With Windows you have two ways to set the path:
  • By calling SET PATH=[whatever your path is] from the command line. This has the downside that it is only set for the lifetime of the command window.
  • By setting the path as an environment variable. How you do that depends on which version of Windows you have. XP is the current version so I'll use that as the example: got to Start>Settings>Control Panel>System, click on the Advanced tab, then the Environment Variables tab. Set it in there.


  • [ November 15, 2006: Message edited by: Paul Sturrock ]
     
    fred rosenberger
    lowercase baba
    Bartender
    Pie
    Posts: 12098
    30
    Chrome Java Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Please don't make the same post more than once. I just spent some time answering in your other post, only to find the discussion over here.

    I have deleted your other thread - now you'll never know what i had to say!
     
    Svend Rost
    Ranch Hand
    Posts: 904
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Goran Dre�njak:
    Problem is on cmd!
    I instal java then I create file hello world, but I dont now how to set path and Svend told me type "javac<filename>" , where I shoud type this?


    I'll try to elaborate on what I wrote earlier.

    1) Create a file called Hello.java in c:\code\
    2) Open the file and insert some java code
    3) Save the file
    4) Open cmd
    5) Type (in cmd)
    "cd\"
    "cd code"
    "javac Hello.java"

    (without the "'s)
    This should compile the java file. Try to run it by typing: java Hello
    (your still in the same directory, i.e. c:\code\)
     
    Jesper de Jong
    Java Cowboy
    Saloon Keeper
    Posts: 15214
    36
    Android IntelliJ IDE Java Scala Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The "Hello World!" for Microsoft Windows tutorial explains in very small steps exactly what you should do. Did you read it? It's the first tutorial in the link that Chris gave you above.

    If you do not know what the Windows command prompt window is or how to use it, see this:

    Introduction to the Windows Command Prompt
    Windows Command Prompt in 15 Minutes
    How to use an MS-DOS Prompt window

    (find more yourself with Google).
    [ November 16, 2006: Message edited by: Jesper Young ]
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic