Hi i have a piece of code thats working on Win 7 but not on XP
import java.io.*; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; class findclasses { static int module = 1; public String find1(String file) throws Exception { String classname = ""; String ccc = ""; String s1 = "", name = " "; String[] s = file.split("\\\\"); int i = 0; for (i = 0; i < s.length - 2; i++) { s1 += s[i] + "\\"; } s1 += s[i]; String path = s1; String filename = s[i + 1]; boolean check = false; FileReader fis = new FileReader(file); BufferedReader b1 = new BufferedReader(fis); while ((s1 = b1.readLine()) != null) { insertclass ic = new insertclass(); if ((check && s1.length() >= 2) || (s1.length() >= 2 && s1.substring(0, 2).equals("/*"))) { check = true; if (!(s1.substring(s1.length() - 2, s1.length()).equals("*/"))) { continue; } else { check = false; } } else { if (s1.length() >= 1 && !(s1.substring(0, 1).equals("/"))) { Pattern p = Pattern.compile("[\\w]+"); Matcher m = p.matcher(s1); while (m.find()) { if ((m.group().equals("class"))) { if (m.find()) { String strTemp = "class" + " " + m.group(); try { Class<?> c=Class.forName(m.group()); System.out.println("Shaumux: "+c); classname += "$" + strTemp; ic.getinput(path, module, filename, m.group(), "class"); } catch (Exception e) { System.out.println(m.group()); } } } } } } } module++; return classname; } }
The problem code is
Class<?> c=Class.forName(m.group());
Runs fine on win 7 but on XP it says class not found. and raises an exception.
I can't figure out the problem
Any help?
Thanks