| Author |
Java beginning
|
Goran Dre�njak
Greenhorn
Joined: Nov 15, 2006
Posts: 4
|
|
|
I instal jdk what is next step?
|
 |
Svend Rost
Ranch Hand
Joined: Oct 23, 2002
Posts: 904
|
|
What do you wish to do? Does this help you? http://www.jibble.org/settingupjava.php
|
 |
Goran Dre�njak
Greenhorn
Joined: Nov 15, 2006
Posts: 4
|
|
|
I want compile programs in cmd!
|
 |
Chris Beckey
Ranch Hand
Joined: Jun 09, 2006
Posts: 116
|
|
Sun has really good tutorials, starting from where you are. See: Java Getting Started Tutorial
|
 |
Svend Rost
Ranch Hand
Joined: Oct 23, 2002
Posts: 904
|
|
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
Joined: Nov 15, 2006
Posts: 4
|
|
|
Yes I see that tutorials but they dont help mee!
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
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.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Goran Dre�njak
Greenhorn
Joined: Nov 15, 2006
Posts: 4
|
|
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
Joined: Apr 14, 2004
Posts: 10336
|
|
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
Joined: Oct 02, 2003
Posts: 9955
|
|
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!
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Svend Rost
Ranch Hand
Joined: Oct 23, 2002
Posts: 904
|
|
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
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
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 ]
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: Java beginning
|
|
|