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
Printable View
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
CompilesCode:javac classname.java
Runs (case-sensitive)Code:java ClassName
Might be better if you got something like JBuilder (http://www.borland.com/jbuilder/)...
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 :(
the console window
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..
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 itQuote:
Posted by Anonymona
where do i save the code?
myjavacode.java.
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?
:confused:
C:\ java -classpath C:\MyDirectory; MyProgram.java
in response to my question, that's not clear at all
but thanks for replying anyway
All you have to do is pull up the DOS console and type in the commands. :p The java console has nothing to do with it. You are using DOS to compile and run your applications.
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
?
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
Since java.exe looks to execute a class file, the class file you specified was not found.Quote:
Exception in thread "main" java.lang.NoClassDefFoundError: GuestBook01/java