English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

It's still in Text format, stored as a .java file. How do I compile? I can't find a program anywhere.... I'm not quite understanding this. I understand how to program, but my book is old and it teaches the old JAVAC command from MSDos.

2006-07-24 16:04:35 · 4 answers · asked by Rockstar 6 in Computers & Internet Programming & Design

4 answers

You can definitely still compile using javac from the command line using the standard Java SE downloadable from java.sun.com. Supposing your source file is "Test.java", you would simply type "javac Test.java". However, you must be in the same directory as the file, or if the file is part of a package the directories must reflect the correct packages. Also, there may be issues if you haven't set up your classpath on your machine.

For all these reasons, I strongly encourage using an IDE such as eclipse to write your code, compile, etc. unless you are pretty familiar already with Java. I've provided the link to the eclipse project as a source.

2006-07-24 16:16:09 · answer #1 · answered by Simon Trueheart 2 · 2 0

Hello, World
By tradition the first programme that anybody writes in an unfamiliar programming language is a "hello, world" programme. Here's the Java version.

publicclassHw
{
public static void main(String[] args)
{
System.out.println("hello, world");
}
}

To get this working any learner's first task is to master the development environment. Assuming that you are using Unix or Linux this is very straightforward. There are three steps.

1 Create a text file called Hw.java containing the text shown above. Any normal text editor will be perfectly satisfactory.
2 Compile (i.e. convert to machine comprehensible form) the programme using the Unix command javac Hw.java. If this proceeds without any problems you will now have a file called Hw.class in your current directory.
3 Run the compiled programme using the Unix command java Hw. You will see the output hello, world.

There are many integrated development environments (IDEs) with elaborate windows and menus that are designed to support medium to large Java development projects, however the simple command line approach is quite good enough to learn a great deal about Java.

2006-07-24 23:29:55 · answer #2 · answered by ihoston 3 · 0 0

You can try javac command to compile the code and java will run your code. You can also try Netbeans or Eclipse IDE. These IDE can help you to manage your project and makes your work fast.
Good luck

2006-07-24 23:12:31 · answer #3 · answered by Lost Identity 2 · 0 0

get an upated book

2006-07-24 23:09:49 · answer #4 · answered by ladycheye 1 · 0 0

fedest.com, questions and answers