Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

problem with JVM

AsmodeoAsmodeo Member Posts: 6
I want to know how to start a .class file from the JVM!!!
I tried to write in the console: "java (.class file)" but it gives me an exception about an error in the class definition, i think!
By the way, i'm running windows xp.

Comments

  • IllcoIllco Member Posts: 382
    : I want to know how to start a .class file from the JVM!!!
    : I tried to write in the console: "java (.class file)" but it gives me an exception about an error in the class definition, i think!
    : By the way, i'm running windows xp.
    :

    Which command exactly did you give? Some beginners (forgive if you're not) tend to write [b]java Filename.class[/b] or (worse) [b]java Filename.java[/b] instead of [b]java Filename[/b]. You should also recompile everything in place (on fails: compile some files manually it may help because the dependencies sometimes get screwed up). Finally, check if there is a main method in the class you're trying to execute.
  • AsmodeoAsmodeo Member Posts: 6
    I used the right command and there is a main. I don't know what to do. I'm not a beginner with java, but i always used the compiler (jbuilder), and i never tried before to do this. But now i had a .class compiled with netbeans, and i can't run it with jbuilder.
    The error is this:
    Exception in thread "main" java.lang.NoClassDefFoundError: Echo (wrong name: prova/Echo)
    at...
    and then 12 lines of "at".
    I found the code of this simple class on a site that explain how to use JVM, so i suppose that is correct.
    I hope you can understand what is my problem!!!
  • IllcoIllco Member Posts: 382
    I think you should run:
    [code]
    java prova.Echo
    [/code]
    Dot instead of slash that is.
  • AsmodeoAsmodeo Member Posts: 6
    don't work!!! but know i've noticed that it gives me the same error even if a try to start an application from the compiler!!! is it possible that the problem is windows xp?
  • IllcoIllco Member Posts: 382
    : don't work!!! but know i've noticed that it gives me the same error even if a try to start an application from the compiler!!! is it possible that the problem is windows xp?
    :

    I don't really get what you mean by starting an application from the compiler: that's not what compilers are made for. Java and XP should not be a problem: it's fine over here. But you should check Sun's website (java.sun.com), they have stuff on these problems. Also search for posts here on the forum on the same subject, we've discussed this problem before.
  • AsmodeoAsmodeo Member Posts: 6
    I've tried many things to start a .class, but i never success. It seems that the JVM can't find the right libraries. Forget about the compiler, it was my fault. Now this is the command of the compiler:

    C:jbuilder5jdk1.3injavaw -classpath "C:Documents and SettingsHellFighterjbprojectprovaclasses;C:jbuilder5libeansipworks.jar;C:jbuilder5jdk1.3demojfcJava2DJava2Demo.jar;C:jbuilder5jdk1.3jrelibi18n.jar;C:jbuilder5jdk1.3jrelibjaws.jar;C:jbuilder5jdk1.3jrelib
    t.jar;C:jbuilder5jdk1.3jrelibsunrsasign.jar;C:jbuilder5jdk1.3libdt.jar;C:jbuilder5jdk1.3lib ools.jar" prova.finestra

    and it works! But if i cancel the classpath attribute, it says that he can't find the main class!!!! What does that mean?
    The .class with the main function is in: C:Documents and SettingsHellFighterjbprojectprovaclassesprova
    and the package name is: prova.
    I'm sorry for my english, but i'm italian!!
  • alexzhenalexzhen Member Posts: 13
    Try this command java -cp . and then the main class file.
  • Andre YoungAndre Young USAMember Posts: 0

    _________ { http://forcoder.org } free ebooks and video tutorials about // MATLAB, Ruby, Go, C, Perl, JavaScript, PL/SQL, Delphi, Swift, Objective-C, Visual Basic .NET, Python, Visual Basic, Assembly, C++, PHP, R, C#, Java, Scratch Awk, Dart, ML, Kotlin, Bash, Logo, D, Julia, ABAP, Hack, Scala, Erlang, COBOL, SAS, LabVIEW, Ada, F#, Scheme, Rust, FoxPro, Crystal, Lua, Apex, Prolog, Fortran, Alice, VBScript, Clojure, Lisp, Transact-SQL // ________

Sign In or Register to comment.