is it Textpad or my coding

Using the Java SDK with TextPad

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

Post Reply
grifflyn
Posts: 2
Joined: Mon Jan 10, 2005 6:21 pm

is it Textpad or my coding

Post by grifflyn »

I am studying Java at Uni and purchased Text pad as my compiler.
I wrote some code today and compiled it at Uni on a Mac (we have to use Macs at Uni) when i got home and FTP'd my files they wont complie in textpad.
I have written an array program and some methods. Two separate programs the array program has to look at the methods and the array program wont wont recognise the methods for some reason.
I have been using text pad for some time now and it works fine but wont work on these two programs

if i submitted my code would someone be able to have a look and let me know if its textpad or my code.

any help would be appreciated

ty Grifflyn
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

TP is an text editor, not a compiler, when you edit source code in it you can set TP up to call extenal tools, shuch as the Java compiler from Sun. When the compiler tool is done TP grabs the results and presents them to you in a seperate TP window called Command results. There you can click on lines and TP will take you to the relevant line in the source code.
To set up the Java tools in TP use the intructions found here.
Make sure you have installed Java on your system first. I hope this helps.
Then I open up and see
the person fumbling here is me
a different way to be
grifflyn
Posts: 2
Joined: Mon Jan 10, 2005 6:21 pm

Post by grifflyn »

Hi s_reynisson,
I have been using TP for some time writing and compiling my java souce code as per your help instructions for writing java code and it has been working fine could there be some problem with TP not recognising the Class that i have wrtten. I have checked the files again at Uni and they work fine but will not work at home i have pasted the code into this topic for you to have a look at.
I purchased TP bacause i found it very usefull with my Xhtml module as well as my Java Module and dont really want to have to learn another program if i can help it.

Thanks in advance Grifflyn
--------------------------------------------------------------------------------------
// Filename: ArrayUtilities.java
// Author
// Last Updated Jan 2005
// by
// class that provides a number of Array Utilities
//
public class ArrayUtilities
{
// Method to reset an integer array so that
// all elements have the value zero

public static void resetArray (final int [] pArray)
{
for (int i = 0; i < pArray.length; i++)
{
pArray = 0;
}
}

// method to output the contents of an integer array

public static void outputArray (final int [] pArray)
{
for (int i = 0 ; i <pArray.length; i++)
{
System.out.print (pArray + " ");
}
System.out.println();

}

// fliename sumArray method to add the integers of
// an array together

public static void sumArray (final int [] pArray)
{
int tSum = 0;

for (int i = 0 ; i <tSum; i++)
{
tSum += pArray ;
}
}
--------------------------------------------------------------------------------------
// filename: ArrayClient.java
// Author:
// Last Updated :Jan 2005
//
// Program to demonstrate how to provide a class
// of array utilities
//

public class ArrayClient
{
public static void main (final String[] pArgs)
{
int [] tArray = new int [4];

tArray [0] = 11;
tArray [1] = 22;
tArray [2] = 33;
tArray [3] = 44;

ArrayUtilities.outputArray (tArray);

ArrayUtilities.resetArray (tArray);

ArrayUtilities.outputArray (tArray);

}
}
--------------------------------------------------------------------------------------
error messages
C:\Documents and Settings\Administrator\Desktop\UNI\Programming\Programming2\week1
\ArrayClient.java:20:
cannot resolve symbol symbol : variable ArrayUtilities location: class ArrayClient ArrayUtilities.outputArray (tArray);
C:\Documents and Settings\Administrator\Desktop\UNI\Programming\Programming2\week1
\ArrayClient.java:22: cannot resolve symbol symbol : variable ArrayUtilities location: class ArrayClient ArrayUtilities.resetArray (tArray);
C:\Documents and Settings\Administrator\Desktop\UNI\Programming\Programming2\week1
\ArrayClient.java:24: cannot resolve symbol symbol : variable ArrayUtilities location: class ArrayClient ArrayUtilities.outputArray (tArray);
3 errors
Tool completed with exit code 1
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

First compile ArrayUtilities.java, it has an error, fix it by adding a closing } at the end of the file.
Make sure ArrayClient.java is in the same folder, compile and run. HTH
Then I open up and see
the person fumbling here is me
a different way to be
Post Reply