Results 1 to 12 of 12

Thread: the sun java compiler..

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Location
    Toronto
    Posts
    15

    the sun java compiler..

    hi

    i've just downloaded the sun microsystems' java compiler (version 1.3.1_03), but have no idea how to use it to execute code.. can someone enlighten me?

    thanks

  2. #2
    Code:
    javac classname.java
    Compiles
    Code:
    java ClassName
    Runs (case-sensitive)

    Might be better if you got something like JBuilder (http://www.borland.com/jbuilder/)...

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Location
    Toronto
    Posts
    15
    thanks, but where do i type that? (in the ms-dos console window or..?)
    where do i save the code..?
    i've never used a compiler like this (that doesn't have an editor window) and am badly stuck

  4. #4
    Banned
    Join Date
    Jun 2002
    Posts
    1
    the console window

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Location
    Toronto
    Posts
    15
    the java console, you mean?
    but you can't type anything in that, it just has a bunch of options..
    where do i save the code?

    bah..

  6. #6
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Posted by Anonymona
    where do i save the code?
    If you are just running the compiler without using an IDE then you would just want to place your code in a .txt file and name it
    myjavacode.java.

  7. #7

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Location
    Toronto
    Posts
    15
    what do i do after that though?
    the java console window has these options:

    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    q: hide console
    s: dump system properties
    t: dump thread list
    x: clear classloader cache
    0-5: set trace level to <n>

    and i can't type anything in it.
    so what do i do to run the code i've saved as say testing.java?



  8. #8

  9. #9

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Location
    Toronto
    Posts
    15
    in response to my question, that's not clear at all
    but thanks for replying anyway

  10. #10
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    All you have to do is pull up the DOS console and type in the commands. The java console has nothing to do with it. You are using DOS to compile and run your applications.

  11. #11

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Location
    Toronto
    Posts
    15
    gotcha, thank you


    but what's wrong with this:

    C:\java -classpath C:\WINNT\Profiles\Administrator\Desktop\jdbc; GuestBook01.java

    it keeps throwing this exception:

    Exception in thread "main" java.lang.NoClassDefFoundError: GuestBook01/java

    ?
    Last edited by Anonymona; Jun 8th, 2002 at 11:01 PM.

  12. #12
    VirtuallyVB
    Guest
    As filburt1 began to say:

    You compile your java source files "GuestBook01.java" with the java compiler "javac.exe"

    C:\javac GuestBook01.java

    which creates
    GuestBook01.class

    Then run it with java.exe and without the ".class" extension
    java GuestBook01

    If you haven't set the CLASSPATH environment variable to C:\WINNT\Profiles\Administrator\Desktop\jdbc;, then your line was almost correct (but you used java.exe not javac.exe)
    C:\javac -classpath C:\WINNT\Profiles\Administrator\Desktop\jdbc; GuestBook01.java

    Exception in thread "main" java.lang.NoClassDefFoundError: GuestBook01/java
    Since java.exe looks to execute a class file, the class file you specified was not found.

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