Solved

appletviewer and java , not  finding/reading? files

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

911 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

21 Experts available now in Live!

Get 1:1 Help Now