Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

starting to learn java

  Asked By: Navin    Date: Mar 02    Category: Java    Views: 1178

I have a question. I found a website that teaches some basics but I
cant get one thing to work which would be probably one of the most
important things to have work..run the applet. I use javac to
compile it, which creates a .class file. After that, I dont know
what to do. The website says to type appletviewer applet.htm into ms-
dos, but when I do that nothing happens except for an error. The
website that im looking at about it is here:



4 Answers Found

Answer #1    Answered By: Isabella Campbell     Answered On: Mar 02

Here is shortcut use all method to get the required
result as per conditions.

i) to run java  application command is
java <file name> //without class  extension
ii) jview /a <file name> //without class extension

iii) use any IDE to run  on pressing the button
use textpad from download.com

all will work
send message for confirmation on my email address

Answer #2    Answered By: Logan Bouchard     Answered On: Mar 02

To test it from browser, create an html file, let's say applet.htm

<applet code="FirstApplet.class" width=200 height=100> </applet>

Make sure this applet.htm saved in the folder where FirstApplet.class
is located.

For your next lesson, try this one to display the hello world... 8)

File: Hello.java
public class  Hello extends java.applet.Applet {
public void paint(java.awt.Graphics g) {
g.drawString("Hello World!",50,50);

Html file: hworld.htm
This will display the Hello World from java  applet <br>
<applet code="Hello.class" width 200 height = 100> </applet>

Answer #3    Answered By: Aidyn Smith     Answered On: Mar 02

That is where I am lost. The instructions say to run  the
filename.htm file, but there is no .htm file  and I do not know how to
create one. I can make webpages and set up one on a website  but not
on the local machine. I dont know what it is talking about. What
steps are necessary after creating a .class file? Everything after
getting the .java to be a .class, anything after that, I dont know
how to do.

Answer #4    Answered By: Abbad Akhtar     Answered On: Mar 02

Don't follow their instruction coz it has an error  or something is
missing. Just open a notepad, paste the content of applet.htm which I
created for you (see below). Then save the file  as applet.htm not
applet.txt (be sure you choose 'all files' for file type  in notepad)
and be sure you save it in the same location of your class  file
(let's say you save your class file at c:\, then you should save the
applet.htm to c:\ also)

Double click the applet.htm in your file explorer in which your
current web browser ( IE or Netscape) will open and it will display
and run  your applet  application.

Didn't find what you were looking for? Find more on starting to learn java Or get search suggestion and latest updates.