Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2007, 11:58 PM
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 12:01 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-08-2007, 12:03 AM
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
Hi JavaNoob,

That is a strange error. Can you rewrite your main method like this and try again:

Code:
public static void main(String[] args)
By the way, please use [code] tag around your codes while posting. It will make your codes more readable!
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-08-2007, 04:11 PM
Member
 
Join Date: Aug 2007
Posts: 10
JavaNoob is on a distinguished road
Thanks! it worked great! Now to figure out the rest of what I am trying to do.


JN
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2 dimensional Lists gapper New To Java 4 01-20-2008 10:01 AM
question about linked lists jkurth Advanced Java 1 11-11-2007 09:33 AM
Tudu Lists 2.1 JavaBean Java Announcements 0 08-10-2007 05:39 PM
how to compare 2 vector lists? oregon New To Java 2 07-25-2007 09:25 PM
Tudu Lists 2.0 JavaBean Java Announcements 0 07-11-2007 04:32 PM


All times are GMT +3. The time now is 10:03 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org