Code 2

General questions about using TextPad

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

Post Reply
User avatar
r_myers04
Posts: 9
Joined: Wed May 24, 2006 1:14 pm
Location: Waterford, Michigan
Contact:

Code 2

Post by r_myers04 »

:( I keep on getting a code 2 when i try to compile can anyone tell me what i'am doing wrong?
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

My thought as to what you are doing wrong, is not providing enough information for us to diagnose the problem. ;)

Quick questions to help the process along: what language? Is the code small enough to post here? Have you compiled an application successfully before? Have you done so within TextPad? Have you changed settings recently? Altered your development environment? What is the exact error statement that is generated?
I choose to fight with a sack of angry cats.
User avatar
r_myers04
Posts: 9
Joined: Wed May 24, 2006 1:14 pm
Location: Waterford, Michigan
Contact:

Post by r_myers04 »

talleyrand wrote:My thought as to what you are doing wrong, is not providing enough information for us to diagnose the problem. ;)

Quick questions to help the process along: what language? Is the code small enough to post here? Have you compiled an application successfully before? Have you done so within TextPad? Have you changed settings recently? Altered your development environment? What is the exact error statement that is generated?
Ok..i open textpad 473 i open the file i compile java and this is the error i get

C:\College Stuff\Documents\Shirt.txt is an invalid option or argument.
Usage: javac <options> <source files>

where <options> includes:
-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 files
-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
User avatar
r_myers04
Posts: 9
Joined: Wed May 24, 2006 1:14 pm
Location: Waterford, Michigan
Contact:

Post by r_myers04 »

talleyrand wrote:My thought as to what you are doing wrong, is not providing enough information for us to diagnose the problem. ;)

Quick questions to help the process along: what language? Is the code small enough to post here? Have you compiled an application successfully before? Have you done so within TextPad? Have you changed settings recently? Altered your development environment? What is the exact error statement that is generated?
i forget here is the file that i'am trying to compile

// Robert Myers

public class shirt
{
public static void main (String args[])
{
double price=29.99;
int ID=42889;
System.out.println("Shirt price" + price);
System.out.println("Shirt ID" + ID);
}
}
/*Shirt price29.99
Shirt ID42889
Press any key to continue ...*/
User avatar
r_myers04
Posts: 9
Joined: Wed May 24, 2006 1:14 pm
Location: Waterford, Michigan
Contact:

Post by r_myers04 »

r_myers04 wrote:
talleyrand wrote:My thought as to what you are doing wrong, is not providing enough information for us to diagnose the problem. ;)

Quick questions to help the process along: what language? Is the code small enough to post here? Have you compiled an application successfully before? Have you done so within TextPad? Have you changed settings recently? Altered your development environment? What is the exact error statement that is generated?
i forget here is the file that i'am trying to compile

// Robert Myers

public class shirt
{
public static void main (String args[])
{
double price=29.99;
int ID=42889;
System.out.println("Shirt price" + price);
System.out.println("Shirt ID" + ID);
}
}
/*Shirt price29.99
Shirt ID42889
Press any key to continue ...*/
I have told you what i have none that is all i can tell you
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

r_myers04 wrote: Ok..i open textpad 473 i open the file i compile java and this is the error i get

C:\College Stuff\Documents\Shirt.txt is an invalid option or argument.
Usage: javac <options> <source files>
So a Java question.

2 things I see. The first is that the file appears to have been saved with the .txt extension. Use the file manager or rename it within Textpad and try recompiling. While you're changing the extension from .txt to .java, go ahead and make the casing of your file reflect that of your class. Thus, you have Shirt.txt (to become Shirt.java to resolve issue #1) and a class named shirt. Unless things have changed in the 4 years since I've done Java, you need to have the name of your class match identically the name of the file. Thus class Shirt is different from class shirt and they should be saved in files Shirt.java and shirt.java respectively. Windows will make one overwrite the other but other operating systems make a distinction between the two---and that's something that Java champions, write once, test everywhere. ;)
I choose to fight with a sack of angry cats.
User avatar
r_myers04
Posts: 9
Joined: Wed May 24, 2006 1:14 pm
Location: Waterford, Michigan
Contact:

Post by r_myers04 »

talleyrand wrote:
r_myers04 wrote: Ok..i open textpad 473 i open the file i compile java and this is the error i get

C:\College Stuff\Documents\Shirt.txt is an invalid option or argument.
Usage: javac <options> <source files>
So a Java question.

2 things I see. The first is that the file appears to have been saved with the .txt extension. Use the file manager or rename it within Textpad and try recompiling. While you're changing the extension from .txt to .java, go ahead and make the casing of your file reflect that of your class. Thus, you have Shirt.txt (to become Shirt.java to resolve issue #1) and a class named shirt. Unless things have changed in the 4 years since I've done Java, you need to have the name of your class match identically the name of the file. Thus class Shirt is different from class shirt and they should be saved in files Shirt.java and shirt.java respectively. Windows will make one overwrite the other but other operating systems make a distinction between the two---and that's something that Java champions, write once, test everywhere. ;)
Thank you i will try that now what Java program do i use it needs to be a Java program with Javac.exe in it?
Post Reply