Results 1 to 4 of 4

Thread: jvm trouble in Linux

  1. #1

    Thread Starter
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332

    jvm trouble in Linux

    i'm experimenting w/ using red hat 8.0 and i'm having trouble with running some of my java class files (lol- i'm not seeing any of these cross-platform benefits yet! i downloaded the j2sdk1.4.1_01 jvm from the sun site and linked both javac and java to in the /bin directory. i managed to compile my class fine
    [root@localhost Java]# javac -verbose Ass2.java
    [parsing started Ass2.java]
    [parsing completed 409ms]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/Object.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/BufferedReader.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/PrintWriter.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/String.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/IOException.class)]
    [checking Ass2]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/Throwable.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/Exception.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/FileOutputStream.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/FileDescriptor.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/File.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/OutputStream.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/Writer.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/InputStreamReader.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/System.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/Reader.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/InputStream.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/PrintStream.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/FilterOutputStream.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/Double.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/Number.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/NumberFormatException.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/IllegalArgumentException.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/RuntimeException.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/Math.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/Error.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/io/FileNotFoundException.class)]
    [loading /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar(java/lang/StringBuffer.class)]
    [wrote Ass2.class]
    [total 1197ms]
    and my class is public and contains a public
    Code:
    public class Ass2 extends Object {
    ...
    	public static void main(String[] args) throws IOException {...}	
    }
    and yet when i try to run it
    [root@localhost Java]# java /windows/d/projects/Java/Ass2.class
    Exception in thread "main" java.lang.NoClassDefFoundError: /windows/d/projects/Java/Ass2/class
    could the problem be that the java bins are my primary drive and on ext3 filesystem while the classes are on the secondary that is fat32? i wouldn't think so as i can read and edit the files fine and play mp3s off that drive.. any advice is good, plz
    "There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein

    If you are programming in Java use www.NetBeans.org

  2. #2

    Thread Starter
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332
    i deleted all the class files and recompiled them and everything works now... but it shouldn't have made a difference should they have?

    fyi: the were originally made using Netbeans and jdk 1.4.1 on WinXP
    "There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein

    If you are programming in Java use www.NetBeans.org

  3. #3
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    The jvm automatically adds the .class extension. So what you actually trying to run is
    /windows/d/projects/Java/Ass2.class.class which I assume doesn't exist. Maybe when you tried again you left out the .class

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    When you call the JVM you don't specify the file to run, you specify the class to run.

    java Ass2.class
    would search for the class 'class' (which is an illegal name) in the package Ass2. Thus it searches for the file class.class in the directory Ass2 which can be a subdirectory of any classpath directory or the current directory.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width