|
-
Jun 8th, 2002, 05:31 PM
#1
Thread Starter
New Member
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
-
Jun 8th, 2002, 05:33 PM
#2
Member
Code:
javac classname.java
Compiles
Runs (case-sensitive)
Might be better if you got something like JBuilder (http://www.borland.com/jbuilder/)...
-
Jun 8th, 2002, 06:14 PM
#3
Thread Starter
New Member
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
-
Jun 8th, 2002, 06:18 PM
#4
Banned
-
Jun 8th, 2002, 06:41 PM
#5
Thread Starter
New Member
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..
-
Jun 8th, 2002, 07:00 PM
#6
Dazed Member
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.
Last edited by Dilenger4; Jun 8th, 2002 at 07:07 PM.
-
Jun 8th, 2002, 07:17 PM
#7
Thread Starter
New Member
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?
-
Jun 8th, 2002, 07:18 PM
#8
Dazed Member
C:\ java -classpath C:\MyDirectory; MyProgram.java
Last edited by Dilenger4; Jun 8th, 2002 at 07:22 PM.
-
Jun 8th, 2002, 07:35 PM
#9
Thread Starter
New Member
in response to my question, that's not clear at all
but thanks for replying anyway
-
Jun 8th, 2002, 07:39 PM
#10
Dazed Member
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.
Last edited by Dilenger4; Jun 8th, 2002 at 08:17 PM.
-
Jun 8th, 2002, 08:02 PM
#11
Thread Starter
New Member
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.
-
Jun 9th, 2002, 10:45 PM
#12
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|