Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. J# Not C#

J# Not C#

Scheduled Pinned Locked Moved C#
helpcsharpdata-structures
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oggychristie
    wrote on last edited by
    #1

    I thought you guys might be able to help. I am still undecided about J#. Can anyone explain why the code snippet below would work in J++ but not in J#. The code compiles okay but it cant find the text file to read from. Instad, the exception I catch is J# filenotfoundexception. The text file is in the right directory. Anyways, appreciate any help. public static String[] getIndonesianwordList(String file){ String IndonesianwordList[] = new String[9]; try{ BufferedReader in = new BufferedReader(new FileReader(file)); String s; int i = 0; while((s=in.readLine())!=null){ StringTokenizer tok = new StringTokenizer( s,DELIMITERS); while(tok.hasMoreTokens()) { String nextWord = tok.nextToken(); System.out.println(nextWord); IndonesianwordList[i] = nextWord;//wordList.add(nextWord); i++; } } } catch(IOException e){ System.out.println(e); System.out.println("error loading array"); } return IndonesianwordList; }

    K 1 Reply Last reply
    0
    • O oggychristie

      I thought you guys might be able to help. I am still undecided about J#. Can anyone explain why the code snippet below would work in J++ but not in J#. The code compiles okay but it cant find the text file to read from. Instad, the exception I catch is J# filenotfoundexception. The text file is in the right directory. Anyways, appreciate any help. public static String[] getIndonesianwordList(String file){ String IndonesianwordList[] = new String[9]; try{ BufferedReader in = new BufferedReader(new FileReader(file)); String s; int i = 0; while((s=in.readLine())!=null){ StringTokenizer tok = new StringTokenizer( s,DELIMITERS); while(tok.hasMoreTokens()) { String nextWord = tok.nextToken(); System.out.println(nextWord); IndonesianwordList[i] = nextWord;//wordList.add(nextWord); i++; } } } catch(IOException e){ System.out.println(e); System.out.println("error loading array"); } return IndonesianwordList; }

      K Offline
      K Offline
      Katalyst
      wrote on last edited by
      #2

      Just a guess, but maybe J# requires a fully qualified path name for FileReader (e.g., "C:\temp\foo.txt" rather than "foo.txt").

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups