Thread: Compare lists
View Single Post
  #1 (permalink)  
Old 08-08-2007, 12:58 AM
JavaNoob JavaNoob is offline
Member
 
Join Date: Aug 2007
Posts: 10
JavaNoob is on a distinguished road
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:

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);} } }
Thanks
JN

Last edited by levent : 08-08-2007 at 01:01 AM.
Reply With Quote
Sponsored Links