Results 1 to 3 of 3
Thread: Compare lists
- 08-07-2007, 10:58 PM #1
Member
- Join Date
- Aug 2007
- Posts
- 10
- Rep Power
- 0
Compare lists
I figure if I give myself a little challenge every couple of days, eventually this JAVA stuff will start sinking in :)
I'm working on a program that will compare two lists. For now I am trying to get familiar with JAVA altogether.
I've written this code with the primary objective to get more familiar with fileWriter and fileReader. Basically, what I want it to do for the time being is to take my two arguments (which will be the name of the read file and the name of the write file), and have the readFile read the file at my first arguement and have writeFile write an arbitrary file that is named after my second argument.
It compiles but does not like it when i run it with arguements
ex:
java listCompare ss.txt 1sttry.txt
Exception in thread "main" java.lang.NoClassDefFoundError: ss/txt
here's my code:
ThanksJava Code:import java.io.*; public class listCompare { public static void main(String []args) { //arguments that tells us what is being compared ot what String Base = args[0]; String Compare = args[1]; //read base file and load it to a string try { FileReader baseFile = new FileReader(Base); BufferedReader buffer= new BufferedReader (baseFile); //String holdFile= baseFile; FileWriter newFile = new FileWriter(Compare); buffer.close(); } catch (IOException e) { System.out.println(e);} } }
JNLast edited by levent; 08-07-2007 at 11:01 PM.
- 08-07-2007, 11:03 PM #2levent Guest
Hi JavaNoob,
That is a strange error. Can you rewrite your main method like this and try again:
By the way, please use [code] tag around your codes while posting. It will make your codes more readable!Java Code:public static void main(String[] args)
- 08-08-2007, 03:11 PM #3
Member
- Join Date
- Aug 2007
- Posts
- 10
- Rep Power
- 0
Similar Threads
-
2 dimensional Lists
By gapper in forum New To JavaReplies: 4Last Post: 01-20-2008, 09:01 AM -
question about linked lists
By jkurth in forum Advanced JavaReplies: 1Last Post: 11-11-2007, 08:33 AM -
Tudu Lists 2.1
By JavaBean in forum Java SoftwareReplies: 0Last Post: 08-10-2007, 04:39 PM -
how to compare 2 vector lists?
By oregon in forum New To JavaReplies: 2Last Post: 07-25-2007, 08:25 PM -
Tudu Lists 2.0
By JavaBean in forum Java SoftwareReplies: 0Last Post: 07-11-2007, 03:32 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks