Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

How To Compile A Txt Document?


  • Please log in to reply
6 replies to this topic

#1 samuel3

samuel3

  • Members
  • 2,349 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:47 AM

Posted 07 August 2008 - 05:21 AM

Right im trying to compile a Txt document and i have no idea how to is there anyone that knows how to compile a TXT document called item.java

BC AdBot (Login to Remove)

 


#2 Geoffc

Geoffc

  • Members
  • 89 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Warragul, Australia
  • Local time:12:47 PM

Posted 09 August 2008 - 09:49 PM

Not clear what you want to achieve, Samuel3.

If by "compile" you mean create, try opening Notepad or Wordpad (Accessories packaged with Vista) and type in the newly-opened document. On completion, Name it to suit yourself.

Or do you actually want to compile an already written Java program?

#3 samuel3

samuel3
  • Topic Starter

  • Members
  • 2,349 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:47 AM

Posted 10 August 2008 - 05:46 AM

compile an already written Java File.

I have to use the CMD commands, but i dont understand it.

Edited by samuel3, 10 August 2008 - 05:47 AM.


#4 nigglesnush85

nigglesnush85

  • Members
  • 4,371 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:UK
  • Local time:01:47 AM

Posted 10 August 2008 - 10:24 AM

Hello samuel3,

First you need to rename the file. To do this you need to open the file in notepad and click file=>save as. set the file type to all files and then name the file item.java.

Now to compile the file you will need to open the command prompt and navigate to the location where the file item.java is saved using the cd and dir commands.

For example dir will list all the files in the directory then using cd you can change directory in the following syntax. cd foldername then enter.

Once the command prompt is in the correct location you can type the following to compile the file.
javac item.java
This will then cann the java compiler to compile the file. It will perform an error check and if there are no problems it will produce a .class file. This is the compiled program. To run the program you need to type in the command prompt
java item
This should then launch the program.
Regards,

Alan.

#5 mackone

mackone

  • Members
  • 18 posts
  • OFFLINE
  •  
  • Local time:08:47 PM

Posted 13 August 2008 - 09:36 AM

Assuming we saved the Java source code from within Notepad, go to the command prompt and compile it.
This is done with the javac compiler command:

javac program.java

Also be sure that the name of the file ends in .html

#6 nigglesnush85

nigglesnush85

  • Members
  • 4,371 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:UK
  • Local time:01:47 AM

Posted 13 August 2008 - 10:06 AM

Also be sure that the name of the file ends in .html

Why? .html is a webpage file, .java is the java code and .class is the compiled program.

Why does the file need to end in .html?
Regards,

Alan.

#7 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:08:47 PM

Posted 01 September 2008 - 12:25 AM

Yes why should the filename end in '.html' ?

I think filename should always end in '.java' for java source code file.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users