Running .java files

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
travelerkgd
Posts: 3
Joined: Mon Jan 23, 2006 4:10 pm

Running .java files

Post by travelerkgd »

I am having difficulty running.java files following their compilation. What is typically done for a file to run properly? Thanks!
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

You don't run .java files.
You compile (javac) .java files which creates .class files aka byte code.
You then java the .class file without the extension.
e.g.

Code: Select all

C:\foo>javac FrequentlyAskedQuestion.java
C:\foo>dir *
 Volume in drive C has no label.
 Volume Serial Number is 1F86-DC58

 Directory of C:\tmp

09/27/2006  02:53 PM              1423 FrequentlyAskedQuestion.java
09/27/2006  02:55 PM               576 FrequentlyAskedQuestion.class
               2 File(s)          1,999 bytes
               0 Dir(s)  10,255,163,392 bytes free
C:\foo>java FrequentlyAskedQuestion
This is the expeced result of running "FrequentlyAskedQuestion"
I choose to fight with a sack of angry cats.
travelerkgd
Posts: 3
Joined: Mon Jan 23, 2006 4:10 pm

Running .class files

Post by travelerkgd »

Yes, I know this... however I am unable to get those to run (the compiled file).... is tehre a setting or path I need to set up? I did this successfuly during a training program last year and am able to run them (they were created on anotehr machine); but I am unable to run any new files created on my local machine.
Post Reply