Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Help with my code please

  1. #1
    Junior Member
    Join Date
    Oct 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Help with my code please

    Hey guys, doing an assessment for school. I don't want the whole code laid out in front of me, I just need help with the error. I am not sure why I am getting this error. The code is not finished at all, but I am stumped on how to get past loading in the things from the text file. Here is my code:

    import java.util.Scanner;
    import java.io.File;
    import java.io.IOException;
     
    public class Hurricanes2
    {
        public static void main(String[] args)throws IOException
        {
            //declare and initialize variables
     
     
            int arrayLength = 59;
            int [] year = new int[arrayLength];
            String [] month = new String[arrayLength];
            int [] pressure = new int[arrayLength];
            int [] windSpeedK = new int[arrayLength];
     
     
     
            File fileName = new File("hurcdata2.txt");
            Scanner inFile = new Scanner(fileName);
     
            //INPUT  - read data in from the file
            int index = 0;
            while (inFile.hasNext())
            {
                year[index] = inFile.nextInt();
                month[index] = inFile.next();
                //pressure[index] = inFile.nextInt();
                //windSpeedK[index] = inFile.nextInt();
                index++;
            }
            inFile.close();
     
     
            //PROCESSING - calculate and convert values
            // convert windspeed from knots to MPH
            // determine category
            // count number of each category
            int [] windSpeedMph = new int[windSpeedK.length];
            for(index = 0; index < windSpeedK.length; index++)
            {
                windSpeedMph[index] = windSpeedK[index] * (int)1.15078;
            }
     
     
     
            //Find min, max and average for category, windspeed and pressure
     
     
     
            //Output - print table using printf to format the columns
     
     
            System.out.println("                      Hurricanes 1980 - 2006");
            System.out.println();
            System.out.println("Year     Hurricane    Category     Pressure (mb)     Wind Speed (mph)");
            System.out.println("=====================================================================");
     
     
     
            System.out.println("=====================================================================");
     
           	for(index = 0; index < windSpeedK.length; index++)
    		{
    		    System.out.println(windSpeedMph[index]);
    		}
     
        }//end main()
    }//end Hurricanes2


    and here is my error:

    Error:Internal error: (java.io.FileNotFoundException) C:\FLVS\APCS\Module 6\Mod06 Practice\.idea\misc.xml (The system cannot find the file specified)
    java.io.FileNotFoundException: C:\FLVS\APCS\Module 6\Mod06 Practice\.idea\misc.xml (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.jav a:138)
    at com.intellij.openapi.util.JDOMUtil.loadDocument(JD OMUtil.java:340)
    at org.jetbrains.jps.model.serialization.JpsLoaderBas e.loadRootElement(JpsLoaderBase.java:69)
    at org.jetbrains.jps.model.serialization.JpsLoaderBas e.loadRootElement(JpsLoaderBase.java:40)
    at org.jetbrains.jps.model.serialization.JpsProjectLo ader.loadFromDirectory(JpsProjectLoader.java:116)
    at org.jetbrains.jps.model.serialization.JpsProjectLo ader.loadProject(JpsProjectLoader.java:98)
    at org.jetbrains.jps.model.serialization.impl.JpsSeri alizationManagerImpl.loadModel(JpsSerializationMan agerImpl.java:41)
    at org.jetbrains.jps.cmdline.JpsModelLoaderImpl.loadM odel(JpsModelLoaderImpl.java:45)
    at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRu nner.java:71)
    at org.jetbrains.jps.cmdline.BuildSession.runBuild(Bu ildSession.java:198)
    at org.jetbrains.jps.cmdline.BuildSession.run(BuildSe ssion.java:113)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandl er$1.run(BuildMain.java:157)
    at org.jetbrains.jps.service.impl.SharedThreadPoolImp l$1.run(SharedThreadPoolImpl.java:41)
    at java.util.concurrent.Executors$RunnableAdapter.cal l(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

    PS:
    It compiles fine, but when I execute it I get this.
    Last edited by joeysnake; October 2nd, 2014 at 06:33 PM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,406
    Thanks
    53
    Thanked 2,399 Times in 2,352 Posts

    Default Re: Help with my code please

    Error:Internal error: (java.io.FileNotFoundException) C:\FLVS\APCS\Module 6\Mod06 Practice\.idea\misc.xml (The system cannot find the file specified)
    The error says that the program can not find the file mentioned in the error message.
    Are you sure that is the correct path and filename?

    The file name in the error message doesn't match the file name in the program????

    How are you trying to execute the program? The error message has references to: org.jetbrains.jps and com.intellij.openapi

    It looks like there is an installation/configuration error for the IDE you are using.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 3
    Last Post: April 27th, 2013, 07:19 AM
  2. Replies: 4
    Last Post: January 24th, 2013, 11:20 AM
  3. Replies: 7
    Last Post: January 24th, 2013, 10:41 AM
  4. Replies: 5
    Last Post: November 14th, 2012, 10:47 AM
  5. Replies: 3
    Last Post: September 3rd, 2012, 11:36 AM

Tags for this Thread