Solved

appletviewer and java , not  finding/reading? files

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now