Results 1 to 2 of 2
  1. #1
    BtRaE is offline Member
    Join Date
    Jul 2012
    Rep Power

    Default trying to get modules to work together.. need help :)

    I keep getting an error: "ThreadGroup.uncaughtException(thread,Throwabl e) line: not available"

    I don't know what this means. I'm guessing I'm not linking my modules correctly can some one interpret?

    Java Code:
    import java.util.*; 
    public class Decoder 
    	public static void main(String[] args)
    		keywork(null, null);
    	static void decrypt()
    		String codedline = "ilyh wkrxvdqg, wzr kxqguhg dqg qlqhwb-wkuhh";
    		char[] cwarr = codedline.toCharArray();
    		String dcline  = "";
    		for(char x : cwarr)
    				int c = (int)x;
    				c = c - 3;
    				if(c > 90 && c < 97)
    					c = c + 26;
    				x = (char)c;
    				dcline = dcline + x;
    				dcline = dcline + x;
    	static void keywork(String dcline, HashMap<String, Integer> hm)
    		int x;
    		for(int i = 1, sw = 0; i == dcline.length(); i++)
    			String strchk = dcline.substring(sw, i);
    			int n = hm.get(strchk);
    	private static HashMap<String, Integer> keywork() 
    		HashMap<String, Integer> hm = new HashMap<String, Integer>(29);
    		hm.put("ONE", 1);
    		hm.put("TWO", 2);
    		hm.put("THREE", 3);
    		hm.put("FOUR", 4);
    		hm.put("FIVE", 5);
    		hm.put("SIX", 6);
    		hm.put("SEVEN", 7);
    		hm.put("EIGHT", 8);
    		hm.put("NINE", 9);
    		hm.put("TEN", 10);
    		hm.put("ELEVEN", 11);
    		hm.put("TWELVE", 12);
    		hm.put("THIRTEEN", 13);
    		hm.put("FOURTEEN", 14);
    		hm.put("FIFTEEN", 15);
    		hm.put("SIXTEEN", 16);
    		hm.put("SEVENTEEN", 17);
    		hm.put("EIGHTEEN", 18);
    		hm.put("NINETEEN", 19);
    		hm.put("TWENTY", 20);
    		hm.put("THIRTY", 30);
    		hm.put("FOURTY", 40);
    		hm.put("FIFTY", 50);
    		hm.put("SIXTY", 60);
    		hm.put("SEVENTY", 70);
    		hm.put("EIGHTY", 80);
    		hm.put("NINETY", 90);
    		hm.put("HUNDRED", 100);
    		hm.put("THOUSAND", 1000);
    		return hm;
    Last edited by BtRaE; 07-09-2012 at 08:05 PM.

  2. #2
    gillbates is offline Member
    Join Date
    Apr 2012
    Rep Power

    Default Re: trying to get modules to work together.. need help :)

    First, get rid of the suppress warning so you can see what's going on.

    Second, decrypt works but since dcline is a local variable it's not available anywhere else.

    Third, you are passing null, null to keywork. Since it's looking for the string dcline (which isn't available) and a HashMap named hm (which hasn't been created) no good can come from this.

    It looks like you are trying to pass it a string like "two hundred and fifty three" and print out 253. You need to return dcline from decrypt to main in order to pass it to keywork. You also can change

    private static HashMap<String, Integer> keywork()


    private static HashMap<String, Integer> createMap()

    and call it before you call keywork to initialize the hashmap. The resulting main would look like this:

    String dcline = decrypt();
    HashMap<String, Integer> hm = createMap();
    keywork(dcline, hm);

    Now as to keywork itself, not knowing exactly what you are trying to do, this will need to be reworked. Assuming that you are trying to convert string numbers to numbers it doesn't make since to look at things in a char[]. You also have to get rid of extraneous things like "hundred and". The following will do the conversion in the keywork method:

    String strchk = "THREE";
    int n = hm.get(strchk);

    You need to figure out how to parse dcline and what to do with the results of the lookup.

Similar Threads

  1. standard communication protocol among modules
    By a1prashant in forum Advanced Java
    Replies: 7
    Last Post: 01-09-2011, 01:39 PM
  2. modules in notepad
    By joypik in forum New To Java
    Replies: 6
    Last Post: 11-22-2010, 05:47 PM
  3. how many modules?
    By joypik in forum New To Java
    Replies: 13
    Last Post: 08-04-2010, 04:46 AM
  4. Inventory book store -Modules
    By saran87 in forum New To Java
    Replies: 2
    Last Post: 08-24-2009, 02:14 PM
  5. Creating J2ee Modules In NetBeans IDE
    By JavaForums in forum NetBeans
    Replies: 0
    Last Post: 07-30-2007, 11:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts