Solved

appletviewer and java , not  finding/reading? files

Posted on 1997-04-27
3
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

623 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