Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

jview.exe vs. java.exe (EASY?)

  Asked By: Darcy    Date: Jun 12    Category: Java    Views: 1931
  

I am having what I believe to be a very simple problem. I am getting
different results running the same program with java.exe (good) vs.
running it with jview (bad).
Here is the output from the command line, which shows the different
result.

C:\DATA\code\java>java HelloWorldApp
Hello World!

C:\DATA\code\java>jview HelloWorldApp

ERROR: java.lang.NoClassDefFoundError

C:\DATA\code\java>set classpath
ClassPath=C:\Program Files\Documentum\Shared\dfc.jar;%DCTMDA%\app;%
DCTMDA%\app\com\documentum\ldap\l
dapfilt.jar;%DCTMDA%\app\com\documentum\ldap\ldapjdk.jar;

I think it may have something to do with the classpath, but I'm not
sure. See classpath above.

I have compiled the hello world class file with javac.

The source code is included further below. Any hints would be
appreciated. The objective is to be able to run the app both in
jview.exe AND java.exe

Share: 

 

8 Answers Found

 
Answer #1    Answered By: Daimon Jones     Answered On: Jun 12

Update on this issue, which still plagues me. I have tried the
following, and still I get the same error with jview. I took the
class file that I generated with javac, and zipped it up with WinZip,
then changed the extension from ZIP to JAR. Then I tried to run jview
with the /cp switch. Here are the results  of the operation:

C:\DATA\code\java>dir
Volume in drive C has no label.
Volume Serial Number is 2480-FBDF

Directory of C:\DATA\code\java

11/21/2002 05:28p <DIR> .
11/21/2002 05:28p <DIR> ..
11/20/2002 01:56p <DIR> create_user
11/20/2002 01:37p 432 HelloWorldApp.class
11/21/2002 05:28p 426 HelloWorldApp.jar
11/20/2002 12:52p 266 HelloWorldApp.java
3 File(s) 1,124 bytes
3 Dir(s) 146,677,760 bytes free

C:\DATA\code\java>jview /cp C:\DATA\code\java\HelloWorldApp.jar
HelloWorldApp

ERROR: java.lang.NoClassDefFoundError


So, I'm still stuck. Everything on the web seems to point to this
being a classpath issue, yet I'm overriding that with the cp option
and I'm still getting the problem.

There must be another factor that is playing into this.

 
Answer #2    Answered By: Aabirah Khan     Answered On: Jun 12

changing the extension from zip to jar would not solve the problem. You
need to use the jar tool provided by Sun Microsystems for creating the
the jar file and it should
solve the problem  if u have the cp option.

 
Answer #3    Answered By: Utsav Shah     Answered On: Jun 12


I dont see any information of MANIFEST.MF files. Do
you have them in your jar files !!!

The manifest file should be inside a folder named
META-INF(case sensitive) and also this file should
contain an entry that contains an entry that points to
the class that contains the main method.
Please also make sure that all the class files that
are referenced in your HelloWorlApp.class are added
into the jar file.

 
Answer #4    Answered By: Ziza Mizrachi     Answered On: Jun 12

Did you ever get an answer to this question? I've run across
something that has me shaking my head. I'm using JDK 1.4.0.01 and if
I compile an applet with javac.exe, it won't run with wjview or in
IE. It runs with AppletViewer and in Netscape without any problems.
When I dig out MS J++ and compile, the class files run just fine
everywhere. This didn't used to be a problem  until I upgraded my
JDK. Is Sun playing games with MS at the user's expense? Is there a
compile option that I'm missing?

 
Answer #5    Answered By: Fairuzah Alam     Answered On: Jun 12

When I compiled with the -verbose switch, I discovered that one of my
classes is using Vectors which now extend AbstractList which is new
since JDK 1.2. I don't remember what Vector used to extend but
apparently wjview and jview don't support the java.util package as
completely as they used to. I could live with avoiding swing in
order to support my IE users that don't want to install the JRE (huge
majority) but now it appears I have to avoid Vectors as well. This
isn't getting any easier.

 
Answer #6    Answered By: Gerardo Morgan     Answered On: Jun 12

I believe it is the other way around: MS is playing games with Sun. I
don't know what version of Windows you are using, but MS has all but
dropped Java support from Windows. If you want to run an applet in IE
at this point you are best of using the Java Plugin.

 
Answer #7    Answered By: Kawakib Mansour     Answered On: Jun 12

It makes for a headache though because I want to use Java.
I've got a ton of users with dialups that don't want to download the
JRE and insist that I use code that works with what they already
have. The people who buy new computers with XP have no choice. They
HAVE to download the JRE but I still have to code for the huge
majority of my users on Win98 and IE5x. I really wish MS would knock
of the BS.

Regardless, people here should be aware that if they build an applet
using jdk 1.4 and java.awt.* for the UI, they can't expect it to
automatically work for all the IE users out there just by avoiding
swing. The Vector class won't work either. I'm sure there's plenty
other classes that the MSVM won't support.

 
Answer #8    Answered By: Julia Hughes     Answered On: Jun 12


The Vector class works just fine. You need to limit your usage to methods
present in the 1.1 API and you need to compile using the -target and associated
options (see the "Cross-Compiling Options" section of the javac documentation).

Maybe even better, download JDK 1.1.8 and use that instead
(java.sun.com/.../index.html). You will need
this to be able to properly cross-compile from JDK 1.4 anyway. Make sure you
grab the documentation while you're there so you know what is available. You
can
get a WinHelp version of this documentation at
http://www.confluent.fr/javadoc/javadoce.html for easier searching.

If you need the Collections classes (List, ArrayList, etc.), you can download
the
Collections for JDK 1.1 by going to the bottom of the Infobus page
(http://java.sun.com/products/javabeans/infobus/).

Also notice that people using MacOS versions less than 10, can only run 1.1
applets as well, so it isn't just users of the MS VM that need this. Also note
that Microsoft is not licensed to supply a VM greater than version 1.1.4, so you
cannot put all of the blame on Microsoft. Neither MS's nor Sun's hands are
clean
in this mess.

 
Didn't find what you were looking for? Find more on jview.exe vs. java.exe (EASY?) Or get search suggestion and latest updates.




Tagged: