i HAVE ERRORS WHEN I COMPILE

WHEN I COMPILE I GET MANY PROBLEMS. HERE ARE MY PROBLEMS WHEN I COMPILE

javac: invalid flag: javac:

Usage: javac <options> <source files>

where possible options include:

it says all thses things and thens says

exception in thread"main" java.lang.noclassdefFoundError: server

press any key to continue......

before i click compile the file when edited it says

@echo off

COLOR 08

title funfun Client

"C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" javac -cp.

"C:\Program Files\Java\jdk1.5.0_06\bin\java.exe" server

pause

Message was edited by:

HELPME111

Message was edited by:

HELPME111

[735 byte] By [HELPME111a] at [2007-11-26 16:01:04]
# 1
It looks like you are using some sort of tool or batch file to compile. You need to post what that is so maybe someone who is familiar with the tool can help you.
atmguya at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 2
oh yea um its a batch file
HELPME111a at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 3

This line is wrong. "C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" javac -cp.I would modify the java.exe line as well. For example, if the class you are compiling is named Server and the Server.java file is in the current directory, the lines would be "C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" -cp . Server.java

"C:\Program Files\Java\jdk1.5.0_06\bin\java.exe" -cp . Server

atmguya at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 4

oh yea and when u compile it is it suppost to day like finished or something

because it says this

exception in thread "main" java.lang. No.Class.DefFoundError: server <wrong name:server>

then it gives me a bunch of stuff and then it says press any key to continue

Message was edited by:

HELPME111

HELPME111a at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 5

> oh yea and when u compile it is it suppost to day

> like finished or something

> because it says this

>

> exception in thread "main" java.lang.

> No.Class.DefFoundError: server <wrong name:server>

> then it gives me a bunch of stuff and then it says

> press any key to continue

>

> Message was edited by:

> HELPME111

If it compiles with no errors, nothing shows. The error you posted is probably from the line that tries to execute the server class - ".......java -cp . server"

The error is telling you that the server.class file that the JVM found does not contain the class you specified. For example, if the batch file says java -cp . Server but you your class is named server.

atmguya at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 6

when i compile it now after all your great work I still have errors. I think its just because im helpless. but... when i do it now it says

@echo off

COLOR 08

Title funfun server

"C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" -cp .Server.Java

"C:\Program Files\Java\jdk1.5.0_06\bin\java.exe" -cp .

pause

then i get this (not in the code)

javac: no source files

Usage: javac <options> <source files>

where possible options include:

-g Generate all debugging info

-g:noneGenerate no debugging info

-g:{lines,vars,source}Generate only some debugging info

-nowarnGenerate no warnings

-verboseOutput messages about what the compiler is doing

-deprecationOutput source locations where deprecated APIs are u

sed

-classpath <path> Specify where to find user class files

-cp <path>Specify where to find user class files

-sourcepath <path> Specify where to find input source files

-bootclasspath <path>Override location of bootstrap class files

-extdirs <dirs>Override location of installed extensions

-endorseddirs <dirs>Override location of endorsed standards path

-d <directory> Specify where to place generated class files

-encoding <encoding>Specify character encoding used by source files

-source <release> Provide source compatibility with specified release

-target <release> Generate class files for specific VM version

-versionVersion information

-help Print a synopsis of standard options

-X Print a synopsis of nonstandard options

-J<flag>Pass <flag> directly to the runtime system

Usage: java [-options] class [args...]

(to execute a class)

or java [-options] -jar jarfile [args...]

(to execute a jar file)

where options include:

-clientto select the "client" VM

-serverto select the "server" VM

-hotspotis a synonym for the "client" VM [deprecated]

The default VM is client.

-cp <class search path of directories and zip/jar files>

-classpath <class search path of directories and zip/jar files>

A ; separated list of directories, JAR archives,

and ZIP archives to search for class files.

-D<name>=<value>

set a system property

-verbose[:class|gc|jni]

enable verbose output

-versionprint product version and exit

-version:<value>

require the specified version to run

-showversion print product version and continue

-jre-restrict-search | -jre-no-restrict-search

include/exclude user private JREs in the version search

-? -helpprint this help message

-Xprint help on non-standard options

-ea[:<packagename>...|:<classname>]

-enableassertions[:<packagename>...|:<classname>]

enable assertions

-da[:<packagename>...|:<classname>]

-disableassertions[:<packagename>...|:<classname>]

disable assertions

-esa | -enablesystemassertions

enable system assertions

-dsa | -disablesystemassertions

disable system assertions

-agentlib:<libname>[=<options>]

load native agent library <libname>, e.g. -agentlib:hprof

see also, -agentlib:jdwp=help and -agentlib:hprof=help

-agentpath:<pathname>[=<options>]

load native agent library by full pathname

-javaagent:<jarpath>[=<options>]

load Java programming language agent, see java.lang.instrument

Press any key to continue . . .

plz help me i beg of u

Message was edited by:

HELPME111

Message was edited by:

HELPME111

HELPME111a at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 7

> when i compile it now after all your great work I

> still have errors. I think its just because im

> helpless. but... when i do it now it says

> [code] @echo off

> COLOR 08

> Title funfun server

> "C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" -cp

> .Server.Java

> "C:\Program Files\Java\jdk1.5.0_06\bin\java.exe" -cp

> .

> pause

You must put a space between the . and Server.java and Server.Java shoud be Server.java.

Then you must change the next line to ...."java.exe -cp . Server"

atmguya at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 8

when i put this in

@echo off

COLOR 08

Title funfun server

"C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" -cp .Server.java.

"C:\Program Files\Java\jdk1.5.0_06\bin\"java.exe -cp . Server"

pause

i get this

javac: no source files

Usage: javac <options> <source files>

where possible options include:

-g Generate all debugging info

-g:noneGenerate no debugging info

-g:{lines,vars,source}Generate only some debugging info

-nowarnGenerate no warnings

-verboseOutput messages about what the compiler is doing

-deprecationOutput source locations where deprecated APIs are u

sed

-classpath <path> Specify where to find user class files

-cp <path>Specify where to find user class files

-sourcepath <path> Specify where to find input source files

-bootclasspath <path>Override location of bootstrap class files

-extdirs <dirs>Override location of installed extensions

-endorseddirs <dirs>Override location of endorsed standards path

-d <directory> Specify where to place generated class files

-encoding <encoding>Specify character encoding used by source files

-source <release> Provide source compatibility with specified release

-target <release> Generate class files for specific VM version

-versionVersion information

-help Print a synopsis of standard options

-X Print a synopsis of nonstandard options

-J<flag>Pass <flag> directly to the runtime system

Exception in thread "main" java.lang.NoClassDefFoundError: Server (wrong name: s

erver)

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:620)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12

4)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)

at java.net.URLClassLoader.access$100(URLClassLoader.java:56)

at java.net.URLClassLoader$1.run(URLClassLoader.java:195)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)

at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

Press any key to continue . . .

when i do this

@echo off

COLOR 08

Title funfun server

"C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" -cp .Server.java.

"C:\Program Files\Java\jdk1.5.0_06\bin\java.exe" -cp . Server

pause

i get this

javac: no source files

Usage: javac <options> <source files>

where possible options include:

-g Generate all debugging info

-g:noneGenerate no debugging info

-g:{lines,vars,source}Generate only some debugging info

-nowarnGenerate no warnings

-verboseOutput messages about what the compiler is doing

-deprecationOutput source locations where deprecated APIs are u

sed

-classpath <path> Specify where to find user class files

-cp <path>Specify where to find user class files

-sourcepath <path> Specify where to find input source files

-bootclasspath <path>Override location of bootstrap class files

-extdirs <dirs>Override location of installed extensions

-endorseddirs <dirs>Override location of endorsed standards path

-d <directory> Specify where to place generated class files

-encoding <encoding>Specify character encoding used by source files

-source <release> Provide source compatibility with specified release

-target <release> Generate class files for specific VM version

-versionVersion information

-help Print a synopsis of standard options

-X Print a synopsis of nonstandard options

-J<flag>Pass <flag> directly to the runtime system

Exception in thread "main" java.lang.NoClassDefFoundError: Server (wrong name: s

erver)

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:620)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12

4)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)

at java.net.URLClassLoader.access$100(URLClassLoader.java:56)

at java.net.URLClassLoader$1.run(URLClassLoader.java:195)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)

at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

Press any key to continue . . .

HELPME111a at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 9
No,"C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" -cp . Server.java
tschodta at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 10

thx but now it comes up like this when i type this in

@echo off

COLOR 08

Title funfun server

"C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" -cp . Server.java

"C:\Program Files\Java\jdk1.5.0_06\bin\java.exe" -cp . Server

pause

then the error comes up like this

Exception in thread "main" java.lang.NoClassDefFoundError: Server (wrong name: s

erver)

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:620)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12

4)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)

at java.net.URLClassLoader.access$100(URLClassLoader.java:56)

at java.net.URLClassLoader$1.run(URLClassLoader.java:195)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)

at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

Press any key to continue . . .

HELPME111a at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 11

> then the error comes up like this

>

> Exception in thread "main"

> java.lang.NoClassDefFoundError: Server (wrong name:

> server)

>

See Reply #5.

It looks like you class is named server, not Server. I recommend changing the source code to "public class Server" instead of "public class server" but it should also work to change your batch file to use server instead of Server.

atmguya at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 12
@echo offCOLOR 08Title funfun public class Server"C:\Program Files\Java\jdk1.5.0_06\bin\javac.exe" -cp . Server.java"C:\Program Files\Java\jdk1.5.0_06\bin\java.exe" -cp . Serverpausewhen i type that in its all the same
HELPME111a at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 13
He recommended changing the source code, not your script.
ejpa at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...
# 14
Hi, am I wrong or you are trying to use the example from Deitel? I had the same problem and to solve that you have to take out the line package Sockets;Try that and I think it磗 gonna work!
Rick_Aragaoa at 2007-7-8 22:22:36 > top of Java-index,Developer Tools,Java Compiler...