error messeges when compiling

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Mark Smith

error messeges when compiling

Post by Mark Smith »

what does all this mean when I compile:
javac: invalid argument: C:\Documents and Settings\mark\My Documents\Marks stuff\javaprogs\charTest.txt
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-O Optimize; may hinder debugging or enlarge class file
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <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
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-target <release> Generate class files for specific VM version


Tool completed with exit code 2

And then of course the application will not run after all this
Mark Schnitzius

Re: error messeges when compiling

Post by Mark Schnitzius »

Not sure how you're doing the compile, but the problem can be that you have spaces in your file path. Trying wrapping it in quotes, if possible.
phat

Re: error messeges when compiling

Post by phat »

Is it right that you are tried to run the charTest file in C:\Documents and Settings\mark\My Documents\Marks stuff\javaprogs\charTest.txt.
Your problem can be solve if you change the name charTest.txt to charTest.java, so it will compile for you. Remember that you have to name all of your program under .java extension.
Little Hint:
In C language --> .c
In C++ --> .ccp
In java --> .java
In assemply --> .s
take care
dano

Re: error messeges when compiling

Post by dano »

In addition, it needs to be named the same as your class name.

So, a class like this:
public class MyApp {
public static void main(String args[]) {
System.exit(0);
}
}

Would need to be saved in a file named MyApp.java.

Dano
Post Reply