Solved

appletviewer and java , not  finding/reading? files

Posted on 1997-04-27
3
394 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 100 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.

810 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