Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

appletviewer and java , not  finding/reading? files

Posted on 1997-04-27
3
Medium Priority
?
411 Views
Last Modified: 2013-11-23
I have installed jdk1.1.1 , using windows 95 , Packard Bell system . I have written and compiled an applet called "JavaNow" it is essintally the "HelloWorld" applet except from the book Java Now . javac successfuly compiled the program into a .class file , I wrote the html file and saved as .html . The problem is when I try to view it with appletviewer the appletviewer window opens with the message " Start: applet not inialized ." at the bottem , the title bar of the window says "JavaNow.class" . When the window first opens instead of "applet not initalized" for about 1 second it flickers something to the effect of " applet starting " . Then when I close the window this message is on the screen : ( the first lines are my comman line entry)



[WINDOWS] C:\>jdk1.1.1\bin\appletviewer jdk1.1.1\learn\JavaNow.html
java.io.FileNotFoundException: \C:\\JavaNow.class
        at java.io.FileInputStream.<init>(FileInputStream.java:64)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection
.java:150)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLCon
nection.java:170)
        at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:115)
        at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:259)
        at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:352)
        at sun.applet.AppletPanel.runLoader(AppletPanel.java:419)
        at sun.applet.AppletPanel.run(AppletPanel.java:223)
        at java.lang.Thread.run(Thread.java:474)
File not found when looking for: JavaNow
java.lang.NullPointerException
        at sun.applet.AppletPanel.runLoader(AppletPanel.java:419)
        at sun.applet.AppletPanel.run(AppletPanel.java:223)
        at java.lang.Thread.run(Thread.java:474)

One note which my be important : When I open the JavaNow.html  file with my NS browser it is displayed correctly .

I have a simmular problem with the java interpreter . Please let me know if thes are seperate problems , thus seperate questions and I will ask the second one in its own post . I will include it here because I think they are both simptomes of the same problem .
When I try to run a basic app called "HelloJava" which has been successfuly compiled into *.class I get the following error message :( with the first lines being my command line entry )
[WINDOWS] C:\>jdk1.1.1\bin\java jdk1.1.1\learn\HelloJava\HelloJava
Invalid class name 'jdk1.1.1\learn\HelloJava\HelloJava'
usage: java [-options] class

where options include:
    -help             print out this message
    -version          print out the build version
    -v -verbose       turn on verbose mode
    -debug            enable remote JAVA debugging
    -noasyncgc        don't allow asynchronous garbage collection
    -verbosegc        print a message when garbage collection occurs
    -noclassgc        disable class garbage collection
    -cs -checksource  check if source is newer when loading classes
    -ss<number>       set the maximum native stack size for any thread
    -oss<number>      set the maximum Java stack size for any thread
    -ms<number>       set the initial Java heap size
    -mx<number>       set the maximum Java heap size
    -classpath <directories separated by semicolons>
                      list directories in which to look for classes
    -prof[:<file>]    output profiling data to .\java.prof or .\<file>
    -verify           verify all classes when read in
    -verifyremote     verify classes read in over the network [default]
    -noverify         do not verify any class

 

0
Comment
Question by:tellurion
3 Comments
 
LVL 2

Expert Comment

by:webster030697
ID: 1219889
1. The Applet viewer expects a .class file, not a .html file. That's why Netscape is working - you're giving it a .html file which it expects. Try "c:>appletviewer JavaNow"

2. Similar problem. As the error message said, you need to type "java HelloJava" at the prompt, not just "HelloJava". You can't run a .class file - they are not executable. You run the java virtual machine, and give it your .class file as a command line parameter. Hence, "c:> java HelloJava"
0
 
LVL 1

Accepted Solution

by:
roy020697 earned 200 total points
ID: 1219890
How about the CLASSPATH environemt variable? I believe it is not required, but if it is set incorrectly then you will need to either unset it or set it correctly. There is a README that gets installed in the jdk1.1.1 directory for your Windows NT installation which discusses this in more detail. It would explain both of your problems.
0
 

Expert Comment

by:Quin042797
ID: 1219891
Have you tried using the CODEBASE parameter in the APPLET tag?

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question