aspose file tools*
The moose likes Beginning Java and the fly likes cannot view applets, and use javac Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cannot view applets, and use javac" Watch "cannot view applets, and use javac" New topic
Author

cannot view applets, and use javac

Ziyoda Mirkhonova
Greenhorn

Joined: Mar 16, 2006
Posts: 10
Dear all,
I want to view applets, or enable my browser to use applets, but if I write appletviewer something.java, it says, appletviewer is invalid command. Also, it won't understand neither javac nor javaw, and others. Then, I tried to do RunApplet through <configure>, <options>, <tools>, <RunApplet> and wrote applet code in html document, (which seems correct) and saved in the same folder where my .class file is, but still, it won't show any applet. No, not any, browser is showing TicTacToe and other applets in j2sdk Demo, Applets folder.

Also, MS_DOS command line does not understand javac.
But I can compile and execute files through JCreator
What do you suggest?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
Welcome to JavaRanch. A couple of points:

- appletviewer takes the name of an HTML page (which contains an applet tag) as parameter, not a .java file

- In order to call javac (as well as appletviewer and other Java executables) from the command line, the directory they're in needs to be part of your PATH environment variable, or you need to specify the full path to them.
On my system, javac is in C:\j2sdk1.4.2_04\bin, so I can call it by typing "C:\j2sdk1.4.2_04\bin\javac something.java" (which I don't do, because I have the C:\j2sdk1.4.2_04\bin directory in my PATH).


Ping & DNS - updated with new look and Ping home screen widget
Ziyoda Mirkhonova
Greenhorn

Joined: Mar 16, 2006
Posts: 10
Hi Ulf Dittmer,
thanks, a lot for warm welcome!

I didn't understand these words:

-appletviewer takes the name of an HTML page (which contains an applet tag) as parameter, not a .java file

Can you explain fully these phrases?
thanks a lot!
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Ziyoda Mirkhonova:
...I didn't understand these words:

-appletviewer takes the name of an HTML page (which contains an applet tag) as parameter, not a .java file

Can you explain fully these phrases? ...

This means that when running appletviewer from a command line, you need to provide it with an HTML file. For example...

appletviewer MyWebPage.html

Inside the HTML of that page should be an <applet> tag, telling it where to find the applet (.class or .jar files).

As Ulf pointed out, the key to running appletviewer (or java, javac, etc.) from the command line without typing the full path every time is to update your PATH variable so that your system knows where to look. Here are Sun's instructions for setting the PATH in Windows.
[ March 16, 2006: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Yu Fei Xu
Greenhorn

Joined: Mar 15, 2006
Posts: 8
hi
You can use Eclipse ,it has a great use on java,
you can download it from the following web,it's free
www.eclipse.org

Have a good touring on eclipse.
Ziyoda Mirkhonova
Greenhorn

Joined: Mar 16, 2006
Posts: 10
Hi everyone,
Thanks for your suggestions!!!
Dear Marc Weber, Sun's instructions worked for javac, but for viewing applets, if I'm writing PATH and appletviewer something.html and applet won't work. Can you check if this code is correct:
<html>
<applet code "Something.class" width="300" height = "300">
</applet>
</html>
Or should I indicate here in code where to find file?
Many thanks to all of you!!!
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Ziyoda Mirkhonova:
...Can you check if this code is correct:
<html>
<applet code "Something.class" width="300" height = "300">
</applet>
</html>
Or should I indicate here in code where to find file? ...

You need an equals sign between the word "code" and the filename. This also assumes that Something.class is located in the current directory (the same as the HTML file). See Applet tag settings for details.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot view applets, and use javac
 
Similar Threads
Applets in Forte
JApplet Browser security issues
Applet Problem
appletviewer not showing applet
How to run the applet from command line?