Re: Simple java test
- From: Alex Hunsley <lard@xxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 Jan 2007 22:20:03 GMT
Howard Brazee wrote:
What is the easiest way someone learning Java can run short little
test programs?
(I don't want to create JBuilder projects with libraries all over the
place for someone who is just wanting to learn)
This is a good question to ask and for a reason: do it the simply and straightforwards way. Forget IDEs (as you are indicating you want to do). If you work with the command line to begin with, you get a feel for what goes on 'under the hood', what is really happening.
Simplest possible way:
Ensure you have Java installed on your system, and the bin/ directory for Java is on your path.
open a command prompt. CD into a directory containing a java source file (e.g. HelloWorld.java).
Compile like so:
javac HelloWorld.java
This creates a HelloWorld.class file.
Run this like so:
java -cp . HelloWorld
(Note: there's no class at the end in above command!)
NB: this assumes your HelloWorld class doesn't have a package statement in it - i.e. the class is in the 'default' package.
lex
.
- References:
- Simple java test
- From: Howard Brazee
- Simple java test
- Prev by Date: Re: blocking pattern
- Previous by thread: Simple java test
- Next by thread: Problem with many items in List (jme)
- Index(es):
Relevant Pages
|