1 / 28

Steps to Display a Text file in an Applet

Steps to Display a Text file in an Applet. Abhishek Mehta. Table of Contents. Initial Conditions Source code screenshots Creating a Jar File Adding a text file in the Jar file Uploading the files on Ftp Server Viewing Applet on the website Errors and Solutions. Initial Conditions.

jaser
Download Presentation

Steps to Display a Text file in an Applet

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Steps to Display a Text file in an Applet Abhishek Mehta

  2. Table of Contents • Initial Conditions • Source code screenshots • Creating a Jar File • Adding a text file in the Jar file • Uploading the files on Ftp Server • Viewing Applet on the website • Errors and Solutions

  3. Initial Conditions • Go to the website http://www.eclipse.org and download the latest version of eclipse. • Extract the downloaded file to a folder and then click the file named “eclipse.exe” • Create a workspace. • Workspace is the area where you create projects / packages / Interface / Class files. • A folder will be created named “Workspace” in C:\Documents and Settings\Abhishek Mehta\workspace.

  4. Source Code Screenshot

  5. Source Code (Cont’d)

  6. Source Code (Cont’d)

  7. Creating a Jar file

  8. Creating a Jar file (Cont’d)

  9. Creating a Jar file (Cont’d)

  10. Creating a Jar file (Cont’d)

  11. Creating a Jar file (Cont’d)

  12. Creating a Jar file (Cont’d)

  13. Jar File Created

  14. Screenshot of Data File

  15. Adding a Text File to a Jar File • Jar files are same as zip files • Open .jar files with winzip or winrar • Add a text file to the archive • Save the file • Next slides will show you the screenshots

  16. Adding a Text File to a Jar File

  17. Adding a Text file to a Jar file

  18. Adding a Text file to a Jar file

  19. View of Jar file after adding the Text File –“data.txt”

  20. Creating HTML File • HTML File is required to view the applet on the website • Name the HTML file with a convenient name • Save the file, in my case it is on the Desktop • The next slide will show the contents of the HTML file

  21. HTML File

  22. Uploading the files on FTP Server • So far we have two files • HTML File • Jar File (Class file + Text File) • Upload the Files on any of the Ftp servers from afs1.njit.edu – afs30.njit.edu • The files should be placed in the “public_html” folder

  23. Screenshot of my FTP space

  24. Applet on Website • Type the following in the address bar http://web.njit.edu/~UCID/filename.html In my case, http://web.njit.edu/~arm36/ReadFile.html

  25. Screenshot of Applet on Website

  26. Applet on Local Computer(using Applet Viewer)

  27. Errors and solution • One Silly mistake; Did you update the new class file • If you don’t see the applet on the website • Check the java file, the class should be defined public OR • Check if both the .jar file and the html file are placed in the same folder OR • Check if you add the data file in the .jar file

  28. References • Eclipse Tutorial • Java 2 SE API

More Related