Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8179167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:56:32+00:00 2026-06-06T23:56:32+00:00

Why am I getting java.lang.ArrayIndexOutOfBoundsException :0 at CopyFile.main //Copy one file Data to another

  • 0

Why am I getting java.lang.ArrayIndexOutOfBoundsException :0 at CopyFile.main

//Copy one file Data to another File
import java.io.*;

class CopyFile{

        public static void main(String[] args)throws IOException{
            FileInputStream fis=new FileInputStream(args[0]);//reading File 
            FileOutputStream fos=new FileOutputStream(args[1]);//reading File
            int data;

            while((data=fis.read())!=-1){
                fos.write(data);
/*here  using while loop to copy data from one file and storing it in another file*/
            }
        }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:56:34+00:00Added an answer on June 6, 2026 at 11:56 pm

    It seems you are running the file as

    java CopyFile
    

    If you do so, its wrong. You should pass the arguments to run your code since your are looking for two arguments.

    Run the code this way:-

    java CopyFile arg1 arg2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting Exception in thread main java.lang.ArrayIndexOutOfBoundsException: 0 at com.ibm.icu.text.BreakDictionary.main(BreakDictionary.java:40) When I run/debug
I'm getting a class cast exception namely java.lang.ClassCastException: android.app.Application cannot be cast to greendroid.app.GDApplication
New to android programming. Getting Following error. 04-07 14:49:05.452: ERROR/AndroidRuntime(1566): FATAL EXCEPTION: main java.lang.OutOfMemoryError
I am getting java.lang.VerifyError.I am posting my log-file and code below. I have looked
I am trying to implement binary search in Java: import java.util.Scanner; public class Search
First off, this is the error I am getting java.lang.OutOfMemoryError at coderaustin.com.FileEncryptor.encryptFile(FileEncryptor.java:56) at coderaustin.com.Main.onCreate(Main.java:41)
i am Consistently getting java.lang.OutOfMemoryError: PermGen space Error in Eclipse while opening any file
This is a continuation from: Recursive Fibonacci memoization . I keep getting an java.lang.ArrayIndexOutOfBoundsException
<oxm:jaxb2-marshaller id=marshaller> <oxm:class-to-be-bound name=myclass/> </oxm:jaxb2-marshaller> I keep getting exception: java.lang.NoSuchMethodError: org.springframework.http.MediaType.sortBySpecificity(Ljava/util/List;)V What is the
Im getting Exception in thread AWT-EventQueue-0 java.lang.ArrayIndexOutOfBoundsException:0 and I really dont understand why. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.