Click to See Complete Forum and Search --> : Java Question


Janet
08-25-2001, 02:11 AM
Im trying to install and below is my error. Any ideas
on what to put in CLASSPATH ??
[root@localhost muffin-0.9.3a]# java muffin
Internal error: caught an unexpected exception.
Please check your CLASSPATH and your installation.
java/lang/ClassNotFoundException: muffin
at java.lang.Class.forName(Class.java:native)
at java.lang.Class.forName(Class.java:53)
Aborted (core dumped)
[root@localhost muffin-0.9.3a]#

Malakin
08-25-2001, 03:01 AM
The INSTALL file that comes with it says to try this:

$CLASSPATH=/path/muffin.jar java Muffin

of course you have to fill in the correct path to muffin.jar as it is on your system.

Janet
08-26-2001, 09:05 AM
Thanks Idealego The path as you can see is below. Ive tried putting that path into CLASSPATH. Im not sure but I put the path in the configure.in file and then ./configure,make,make install the prog again. Is this correct ?? This Java prog doesnt make uninstall so I just configure it again.
It doesnt seem to make any difference so Im figuring that Im doing something else wrong procedure wise.
here is the path:
[Janet@localhost Janet]$ java muffin
Internal error: caught an unexpected exception.
Please check your CLASSPATH and your installation.
java/lang/ClassNotFoundException: muffin
at java.lang.Class.forName(Class.java:native)
at java.lang.Class.forName(Class.java:53)
Aborted
[Janet@localhost Janet]$ cd /home/Janet/tmp/muffin-0.9.3a/src
[Janet@localhost src]$ ls
MANIFEST.MF Makefile~ UK/ images/ muffin.jar sdsu/
Makefile Muffin.class doc/ muffin* objlist* srclist*
Makefile.in Muffin.java gnu/ muffin.in org/
[Janet@localhost src]$

sym
08-26-2001, 03:02 PM
I've answered this exact question twice in the last week for Wavesurfer (I think that was who it was), about Muffin even. Do a forum search to see what I said.

The one thing is that if it is packaged into a .jar file, there won't be a directory structure leading down to Muffin.class, and the CLASSPATH needs to point to to .jar file.

Also, you may want to try java org.xxx.yyy.Muffin, or java -jar Muffin.jar.

Malakin
08-26-2001, 03:58 PM
The only way forum search seems to be working these days is if you do a search by member number.

Janet
08-27-2001, 12:37 AM
Thanks ,
No wavesurfer is asking questions about Tinyproxy a couple of pages back and is still looking for help I think.
Im going arouind in circles on this one. Below Ive tried yr suggestions. Muffin.jar is in the /usr/local/lib Ive tried changing ther CLASSPATH to that no luck.
Ive tried downloading muffin-0.9.3a.jar and putting it in a /lib directory and pointing CLASSPATH to that. Same problem. So Im thinking that Im not changing the CLASSPATH correctly. I go to configure.in and use a text editor to change CLASSPATH. Then I do a configure,make,make install. I also changed the permissions to 744. Still no luck. As you can see below the muffin.jar exists and has 744 permissions.
Any ideas ??!!
[Janet@localhost Janet]$ java -jar Muffin.jar
Can't access JAR file ``Muffin.jar'': java.io.IOException: No such zip file Muffin.jar
[Janet@localhost Janet]$ java org.doit.Muffin
Internal error: caught an unexpected exception.
Please check your CLASSPATH and your installation.
java/lang/ClassNotFoundException: org/doit/Muffin
at java.lang.Class.forName(Class.java:native)
at java.lang.Class.forName(Class.java:53)
Aborted
[Janet@localhost Janet]$ cd tmp
[Janet@localhost tmp]$ ls
BCWipe-0.2-3.i386.rpm geheimnis_2.tar.gz
BC_Panel-0.2-1.i386.rpm hylafax-4.1.tar.gz
BestCrypt-0.8-5.src.rpm j2re-1_3_1-linux-i386-rpm.bin
L871-3405TMP.html kaffe-1.0.6-8mdk.i586.rpm
LimeWireLinux.tgz khylafax-0.3.1/
PGPcmdln_6.5.8.Lnx_FW.rpm.tar ktail-0.5.1.tar.gz
PGPcmdln_6.5.8.Lnx_FW.tar.gz localProxy01-08-24.zip
PGPcmdln_6.5.8_Lnx_FW.rpm* logcheck-1.1.1/
PGPcmdln_6.5.8_Lnx_FW.rpm.sig* mix-2.9b23.tar.gz
PGPcmdln_6.5.8_Lnx_FW.tar.gz* muffin-0.9.3a/
PGPcmdln_6.5.8_Lnx_FW.tar.gz.sig* muffin-0.9.3a.tar.gz
WhatsNew.htm* rp8_linux_alpha_rh62_cs1.bin
WhatsNew.txt* squidconf2.4s1.tar.gz
apsfilter/ stone-2.1a/
apsfilter-6.1.1.tar.gz stone-2.1a.tar.gz
bookmark.htm* dante-1.1.10/ dante-1.1.10.tar.gz.part wine-20010820-1.src.rpm
firestarter-0.7.1-1.i386.rpm
[Janet@localhost tmp]$ cd muffin-0.9.3a/
[Janet@localhost muffin-0.9.3a]$ cd lib
[Janet@localhost lib]$ ls
muffin-0.9.3a.jar*
[Janet@localhost lib]$ ls -l
total 408
-rwxr--r-- 1 Janet Janet 411255 Aug 18 21:33 muffin-0.9.3a.jar*
[Janet@localhost lib]$

Linuxcool
08-27-2001, 01:43 AM
Is this the thread (http://www.linuxnewbie.org/cgi-bin/ubbcgi/ultimatebb.cgi?ubb=get_topic&f=1&t=022071) that you are thinking of sym?

[ 27 August 2001: Message edited by: Linuxcool ]

Janet
08-27-2001, 07:44 PM
Whats this ??!! Stop teasing and give me an answer !!

Janet
08-27-2001, 08:24 PM
OK oppologies weve been doubling up. Sorry for confusion.

Linuxcool
08-28-2001, 12:06 AM
I noticed in the command that you executed (java -jar Muffin.jar) that you called the file Muffin.jar, but the file listed in the directory is muffin-0.9.3a.jar. Would that make a difference?

Janet
08-28-2001, 03:12 AM
Linux cool hello again,
[Janet@localhost Janet]$java org.doit.muffin-0.9.3a.jar
Internal error: caught an unexpected exception.
Please check your CLASSPATH and your installation.
java/lang/ClassNotFoundException: org/doit/muffin-0/9/3a/jar
at java.lang.Class.forName(Class.java:native)
at java.lang.Class.forName(Class.java:53)
Aborted
This Java seems to be something else. I cant seem to get a clear answer on whats wrong but hey this is Linux !!

sym
08-28-2001, 08:24 AM
Just set the classpath on the commandline. use : java -cp <classpath> -jar Muffin.jar

Don't forget the -jar option!

Or what ever the jar name is.

What version of java are you using? (type java -version)

[ 28 August 2001: Message edited by: sym ]

[ 28 August 2001: Message edited by: sym ]

Janet
08-28-2001, 09:24 AM
Thanks yr reply. Thinking about it maybe Im making a basic error as the muffin.jar is installed in /home/Janet/tmp/muffin-0/9/3a/src . According to the manual it should be in /usr/local/lib. I remember putting a copy of muffin.jar in the /lib directory and still not being able to run the prog. I know this is basic but if I download an prog in my normal user mode and install also in normal user mode doing an SU before the make install will the prog install the files to the correct directories ? It seems that most of the files are not going where they should.
Below is the Java version and my latest attempt :
Kaffe Virtual Machine
Copyright (c) 1996-2000
Transvirtual Technologies, Inc. All rights reserved
Engine: Just-in-time v3 Version: 1.0.6 Java Version: 1.1
[Janet@localhost Janet]$ java -cp CLASSPATH=/usr/local/lib/muffin.jar
Internal error: caught an unexpected exception.
Please check your CLASSPATH and your installation.
java/lang/ClassNotFoundException: CLASSPATH=/usr/local/lib/muffin/jar
at java.lang.Class.forName(Class.java:native)
at java.lang.Class.forName(Class.java:53)
Aborted
[Janet@localhost Janet]$ java -cp CLASSPATH=/home/Janet/tmp/muffin-0.9.3a
/src
Internal error: caught an unexpected exception.
Please check your CLASSPATH and your installation.
java/lang/ClassNotFoundException: CLASSPATH=/home/Janet/tmp/muffin-0/9/3a/src
at java.lang.Class.forName(Class.java:native)
at java.lang.Class.forName(Class.java:53)
Aborted

chikn
08-28-2001, 09:26 AM
All this talk bout muffins make me hungry! :p

sym
08-28-2001, 11:15 AM
you probably don't want the .src directory, that is the .java files, you want the .class files.

Dru Lee Parsec
08-28-2001, 02:00 PM
OK, has ANYONE actually answered this question yet? ;)

1st, Post your Java questions on the programmer's forum and I'll usually get to them pretty quick. I tend to hang out there more than here and I love bringing more people to Java.

Classpath defined: Don't confuse classpath with path. PATH tells your OS where to find executable files. For example, the JDK1.3/bin directory which has all your executable java files like java, javac, appletviewer and so on must be in your path.

The classpath tells the JVM where to find YOUR class files or your jar files. In versions of Java prior to 1.2 you use to have to put the java run time jar in the classpath. You no longer need to do that. Only your own files or files that you want to run must be accessable via the classpath

Let's take the most likely variations of a classpath one at a time.

1) You are writing a basic java program (like a Hello World program) that does not use packages. The .java and .class files are both in your ~/myjava directory. In this case the CLASSPATH should point to ~/myjava because that's where the .class files are (Remember, the classpath tells java how to fine the class files)

2) You have a program that is arranged into packages. Your package structure is something like com.lambada.gui com.lambada.util com.lambada.actions and so on. Let's say that you have a directory structure like this: In my ~/devprojects/lambada directory I have all my source files under the src directory (which means there will be directories like src/com/lambada/gui, src/com/lambada/util and so on)

Let's also assume that my build system (I use "Ant" ) arranges all the compiled classes under the ~/devprojects/lambada/lib directory. (which means that the class files will be in directories like ~/devprojects/lambada/lib/com/lambada/gui ~/devprojects/lambada/lib/com/lambada/util ~/devprojects/lambada/lib/com/lambada/actions and so on)

In this case the JVM will automatically append the package to the classpath. So you need only to put ~/devprojects/lambada/lib in your classpath for all these directories to be accessable.

3) The next case is using a jar file. A well designed jar file should have a manifest file in it which contains a line that looks something like this:

Main-Class: [classname that has the main method]

Be sure there is a carriage return at the end of this line. If there isn't then it won't work. (that is, if you're building your own jar file. If you're using sombody elses jar then it almost certainly has the correct Main-Class line in it)

Now, instead of running the file like this:

java -classpath [path to the main method] [classname of the file with the main method]

You can just run the program like this:

java -jar [jar filename]

So the line to execute your program would be

java -jar muffin-0.9.3a.jar provided you are in the same directory as muffin-0.9.3a.jar

You may have to do this
java -jar ./muffin-0.9.3a.jar or
java -jar [path to the jar file]/muffin-0.9.3a.jar
in order for your OS to be able to find muffin-0.9.3a.jar

Therefore, in order to run your jar file, you don't actually need to modify the classpath at all. The -jar flag essentially means "every class in this jar is in my classpath".

Hope it helps. :)

Cheers

sym
08-29-2001, 08:26 AM
Nice answer Dru Lee Parsec, somebody should make that into a NHF so we can just refer people there.

Janet
08-29-2001, 09:19 AM
Thanks Dru Lee great post. Alot way over my head but you are definetly the Java man.
java -jar muffin.jar worked.
Many thanks also to the other posters Sym and Linuxcool.

Janet
08-29-2001, 09:21 AM
Idealego as well.

Dru Lee Parsec
08-29-2001, 07:26 PM
Thanks for the kind reviews :)

BTW in regards to this:
Below is the Java version and my latest attempt :
Kaffe Virtual Machine Copyright (c) 1996-2000


The Kaffe virtual machine is ancient (It's version 1.1 which is at least 3 years old) I've actually turned in a bug report on this to Mandrake. The real problem is that it puts teh executable files right in the /usr/bin directory so if you install one of the latest versions of Java (like 1.3 or 1.4) then most likely your /usr/bin directory in in your path first, so you'll actually be running the old Kaffe JVM instead of the one you thought you installed.

Type "which java" at the command line to see if you're getting the one in /usr/bin or in [some path]/jdk1.3/bin (which is the correct one)

It's a bear to remove because you have to know exactly which files are related to the Kaffe install. I "think" that you can do an uninstall if you know what the RPM file was that installed Kaffe. I bet it's something like Kaffexxx.rpm

So that's one more issue that you have to worry about.

Too bad, since Java is suppose to be so easy for everyone to run.