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?
- 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).
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...
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
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.
Joined: Mar 16, 2006
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!!!
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.