Running a jar - JSONObject throwing IllegalArgumentException












0















I have built a program in java, and running it in IntelliJ is fine, but when I build the artifact (jar) and run it in the command prompt on my computer, it throws the IllegalArgumentException.



I am using java-json.jar as my library to make a string (that is in JSON form) into a JSON object so that I can iterate through it and display the information as needed.



Here are the results of running the program in CMD:



    C:UsersDeskTopIdeaProjectsOperationGamerProfileoutartifactsOperationGamerProfile_jar>java -jar OperationGamerProfile.jar
Thank you for choosing Operation Gamer Profile!
Please read the manual that was provided with this tool so that you know how to use it...
Lets get started...

The client ID is: (My client ID)
The client Secret is: (My client secret)
Please enter your authorization token(This is CASE SENSITIVE): (my token)
Result from blizzard: {"characters":[{"name":"Netherfry","realm":"Bleeding Hollow","battlegroup":"Ruin","class":5,"race":8,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"bleeding-hollow/27/163571995-avatar.jpg","lastModified":0},{"name":"Netherwarz","realm":"Darkspear","battlegroup":"Cyclone","class":9,"race":5,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"darkspear/130/86434434-avatar.jpg","guild":"GeekyGaming","guildRealm":"Darkspear","lastModified":0},{"name":"Hailnether","realm":"Akama","battlegroup":"Reckoning","class":1,"race":2,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"akama/235/95051243-avatar.jpg","lastModified":0},{"name":"Hailnether","realm":"Khaz Modan","battlegroup":"Cyclone","class":2,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"khaz-modan/53/101812021-avatar.jpg","lastModified":0},{"name":"Hailne6EA459","realm":"Greymane","battlegroup":"Shadowburn","class":5,"race":11,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"greymane/89/91137113-avatar.jpg","lastModified":0},{"name":"Netherdrew","realm":"Bleeding Hollow","battlegroup":"Ruin","class":11,"race":8,"gender":0,"level":91,"achievementPoints":1470,"thumbnail":"bleeding-hollow/134/156092806-avatar.jpg","spec":{"name":"Guardian","role":"TANK","backgroundImage":"bg-druid-bear","icon":"ability_racial_bearform","description":"Takes on the form of a mighty bear to absorb damage and protect allies.rnrnPreferred Weapon: Staff, Polearm","order":2},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1429907056000},{"name":"Hailnether","realm":"Wyrmrest Accord","battlegroup":"Cyclone","class":3,"race":4,"gender":0,"level":3,"achievementPoints":0,"thumbnail":"wyrmrest-accord/146/109003154-avatar.jpg","lastModified":0},{"name":"Netherwraith","realm":"Bleeding Hollow","battlegroup":"Ruin","class":9,"race":10,"gender":0,"level":16,"achievementPoints":1305,"thumbnail":"bleeding-hollow/72/157163336-avatar.jpg","spec":{"name":"Affliction","role":"DPS","backgroundImage":"bg-warlock-affliction","icon":"spell_shadow_deathcoil","description":"A master of shadow magic who specializes in drains and damage-over-time spells.rnrnPreferred Weapon: Staff, Wand, Dagger, Sword","order":0},"lastModified":1411674035000},{"name":"Nethermonk","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/13/157523981-avatar.jpg","lastModified":0},{"name":"Netherhunt","realm":"Bleeding Hollow","battlegroup":"Ruin","class":3,"race":2,"gender":0,"level":11,"achievementPoints":1380,"thumbnail":"bleeding-hollow/245/163559157-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1425762452000},{"name":"Netherlock","realm":"Cho'gall","battlegroup":"Vindication","class":9,"race":10,"gender":0,"level":16,"achievementPoints":0,"thumbnail":"chogall/88/110060376-avatar.jpg","guild":"Mindless","guildRealm":"Cho'gall","lastModified":0},{"name":"Bi?¬zzard","realm":"Bloodhoof","battlegroup":"Ruin","class":1,"race":2,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bloodhoof/42/108061994-avatar.jpg","lastModified":0},{"name":"Netherman","realm":"Cho'gall","battlegroup":"Vindication","class":3,"race":10,"gender":0,"level":20,"achievementPoints":1370,"thumbnail":"chogall/223/109983711-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"IliilBARCODEliilI","guildRealm":"Cho'gall","lastModified":1425698021000},{"name":"Yoursbaby","realm":"Moon Guard","battlegroup":"Reckoning","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"moon-guard/213/116473301-avatar.jpg","lastModified":0},{"name":"Hailne652387","realm":"Bladefist","battlegroup":"Vengeance","class":5,"race":11,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"bladefist/135/107291527-avatar.jpg","lastModified":0},{"name":"Aazzdf","realm":"Bleeding Hollow","battlegroup":"Ruin","class":1,"race":2,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/145/164662417-avatar.jpg","lastModified":0},{"name":"Nethersquad","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"bleeding-hollow/36/157524004-avatar.jpg","lastModified":0},{"name":"Darknether","realm":"Bleeding Hollow","battlegroup":"Ruin","class":6,"race":10,"gender":0,"level":62,"achievementPoints":1380,"thumbnail":"bleeding-hollow/118/156625270-avatar.jpg","spec":{"name":"Unholy","role":"DPS","backgroundImage":"bg-deathknight-unholy","icon":"spell_deathknight_unholypresence","description":"A master of death and decay, spreading infection and controlling undead minions to do his bidding.rnrnPreferred Weapon: Two-Handed Axe, Mace, Sword","order":2},"lastModified":1425841594000},{"name":"Lpeodke","realm":"Hellscream","battlegroup":"Rampage","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"hellscream/115/106721395-avatar.jpg","lastModified":0}]}

Starting JSONObjects
java.lang.IllegalArgumentException
at sun.net.www.ParseUtil.decode(Unknown Source)
at sun.misc.URLClassPath$JarLoader.<init>(Unknown Source)
at sun.misc.URLClassPath$3.run(Unknown Source)
at sun.misc.URLClassPath$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getNextLoader(Unknown Source)
at sun.misc.URLClassPath.getResource(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.OperationGamerProfile.Main.main(Main.java:52)

C:UsersDeskTopIdeaProjectsOperationGamerProfileoutartifactsOperationGamerProfile_jar>


Here is the htmlGetRequest method:



private static String htmlGetRequest(String urlToRead) throws Exception {
StringBuilder result = new StringBuilder();
URL url = new URL(urlToRead);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
result.append(line);
}
rd.close();
return result.toString();
}


Here is the code with the JSON:



try {
//getting data
String result = htmlGetRequest(url);
System.out.println("Result: " + result);
System.out.println();

System.out.println("Starting JSONObjects");

***//ERROR STARTS HERE***
JSONObject jsonobject = new JSONObject(result);

System.out.println("Built object");

JSONArray jsonArray = jsonobject.getJSONArray("characters");

System.out.println("Built Array");

for (int i = 0; i < jsonArray.length(); i++) {
JSONObject explrObject = jsonArray.getJSONObject(i);
String gender;
if (explrObject.get("gender").toString().equals("0")) {
gender = "Male";
} else {
gender = "Female";
}

String charClass = "";
switch(explrObject.get("class").toString()) {
case "1": charClass = "Warrior"; break;
case "2": charClass = "Paladin"; break;
case "3": charClass = "Hunter"; break;
case "4": charClass = "Rogue"; break;
case "5": charClass = "Priest"; break;
case "6": charClass = "Death Knight"; break;
case "7": charClass = "Shaman"; break;
case "9": charClass = "Mage"; break;
case "8": charClass = "Warlock"; break;
case "10": charClass = "Monk"; break;
case "11": charClass = "Druid"; break;
case "12": charClass = "Demon Hunter"; break;
}
System.out.printf("Information of character %d:n" +
"t Name: %sn" +
"t Level: %sn" +
"t Gender: %sn" +
"t Class: %sn"
, i+1, explrObject.get("name"), explrObject.get("level"), gender, charClass);
System.out.println();
}

System.out.println("Done displaying JSON Data...nExiting program...");

} catch(Exception e) {
e.printStackTrace();
}


At first I was getting NoClassDefFoundError, and ended up finding the classpath in IntelliJ and pasted this into it: "set classpath=%classpath%;.;", that seemed to fix the problem of the class not being found, but led to the error of IllegalArgumentException.



If anyone is able to help here, I would greatly appreciate it, if you need anymore details of the program, I am happy to provide them.



result contains: Result from blizzard:



{"characters":[{"name":"Netherfry","realm":"Bleeding Hollow","battlegroup":"Ruin","class":5,"race":8,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"bleeding-hollow/27/163571995-avatar.jpg","lastModified":0},{"name":"Netherwarz","realm":"Darkspear","battlegroup":"Cyclone","class":9,"race":5,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"darkspear/130/86434434-avatar.jpg","guild":"GeekyGaming","guildRealm":"Darkspear","lastModified":0},{"name":"Hailnether","realm":"Akama","battlegroup":"Reckoning","class":1,"race":2,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"akama/235/95051243-avatar.jpg","lastModified":0},{"name":"Hailnether","realm":"Khaz Modan","battlegroup":"Cyclone","class":2,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"khaz-modan/53/101812021-avatar.jpg","lastModified":0},{"name":"Hailne6EA459","realm":"Greymane","battlegroup":"Shadowburn","class":5,"race":11,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"greymane/89/91137113-avatar.jpg","lastModified":0},{"name":"Netherdrew","realm":"Bleeding Hollow","battlegroup":"Ruin","class":11,"race":8,"gender":0,"level":91,"achievementPoints":1470,"thumbnail":"bleeding-hollow/134/156092806-avatar.jpg","spec":{"name":"Guardian","role":"TANK","backgroundImage":"bg-druid-bear","icon":"ability_racial_bearform","description":"Takes on the form of a mighty bear to absorb damage and protect allies.rnrnPreferred Weapon: Staff, Polearm","order":2},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1429907056000},{"name":"Hailnether","realm":"Wyrmrest Accord","battlegroup":"Cyclone","class":3,"race":4,"gender":0,"level":3,"achievementPoints":0,"thumbnail":"wyrmrest-accord/146/109003154-avatar.jpg","lastModified":0},{"name":"Nethermonk","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/13/157523981-avatar.jpg","lastModified":0},{"name":"Netherwraith","realm":"Bleeding Hollow","battlegroup":"Ruin","class":9,"race":10,"gender":0,"level":16,"achievementPoints":1305,"thumbnail":"bleeding-hollow/72/157163336-avatar.jpg","spec":{"name":"Affliction","role":"DPS","backgroundImage":"bg-warlock-affliction","icon":"spell_shadow_deathcoil","description":"A master of shadow magic who specializes in drains and damage-over-time spells.rnrnPreferred Weapon: Staff, Wand, Dagger, Sword","order":0},"lastModified":1411674035000},{"name":"Netherhunt","realm":"Bleeding Hollow","battlegroup":"Ruin","class":3,"race":2,"gender":0,"level":11,"achievementPoints":1380,"thumbnail":"bleeding-hollow/245/163559157-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1425762452000},{"name":"Netherlock","realm":"Cho'gall","battlegroup":"Vindication","class":9,"race":10,"gender":0,"level":16,"achievementPoints":0,"thumbnail":"chogall/88/110060376-avatar.jpg","guild":"Mindless","guildRealm":"Cho'gall","lastModified":0},{"name":"Biìzzard","realm":"Bloodhoof","battlegroup":"Ruin","class":1,"race":2,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bloodhoof/42/108061994-avatar.jpg","lastModified":0},{"name":"Netherman","realm":"Cho'gall","battlegroup":"Vindication","class":3,"race":10,"gender":0,"level":20,"achievementPoints":1370,"thumbnail":"chogall/223/109983711-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"IliilBARCODEliilI","guildRealm":"Cho'gall","lastModified":1425698021000},{"name":"Yoursbaby","realm":"Moon Guard","battlegroup":"Reckoning","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"moon-guard/213/116473301-avatar.jpg","lastModified":0},{"name":"Hailne652387","realm":"Bladefist","battlegroup":"Vengeance","class":5,"race":11,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"bladefist/135/107291527-avatar.jpg","lastModified":0},{"name":"Aazzdf","realm":"Bleeding Hollow","battlegroup":"Ruin","class":1,"race":2,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/145/164662417-avatar.jpg","lastModified":0},{"name":"Nethersquad","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"bleeding-hollow/36/157524004-avatar.jpg","lastModified":0},{"name":"Darknether","realm":"Bleeding Hollow","battlegroup":"Ruin","class":6,"race":10,"gender":0,"level":62,"achievementPoints":1380,"thumbnail":"bleeding-hollow/118/156625270-avatar.jpg","spec":{"name":"Unholy","role":"DPS","backgroundImage":"bg-deathknight-unholy","icon":"spell_deathknight_unholypresence","description":"A master of death and decay, spreading infection and controlling undead minions to do her bidding.rnrnPreferred Weapon: Two-Handed Axe, Mace, Sword","order":2},"lastModified":1425841594000},{"name":"Lpeodke","realm":"Hellscream","battlegroup":"Rampage","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"hellscream/115/106721395-avatar.jpg","lastModified":0}]}`


Sorry for the spaghetti code...










share|improve this question




















  • 1





    Please copy the stacktrace from cmd to your post and remove the attached picture.

    – samabcde
    Nov 26 '18 at 2:25











  • @samabcde Done :)

    – Tyler
    Nov 26 '18 at 17:50











  • Is result really a parseable json string? If so, you should probably change the name of the getHTML method.

    – The Head Rush
    Nov 26 '18 at 18:01











  • @TheHeadRush Oh, I see how that could be a confusing name. getHTML is going to blizzard and requesting my character list from them. I'll edit the post and give you the contents of result at the bottom of it.

    – Tyler
    Nov 26 '18 at 18:04













  • @TheHeadRush I'm going to change getHTML to htmlGetRequest, because it is a get request, thanks for the input on that. :)

    – Tyler
    Nov 26 '18 at 18:10
















0















I have built a program in java, and running it in IntelliJ is fine, but when I build the artifact (jar) and run it in the command prompt on my computer, it throws the IllegalArgumentException.



I am using java-json.jar as my library to make a string (that is in JSON form) into a JSON object so that I can iterate through it and display the information as needed.



Here are the results of running the program in CMD:



    C:UsersDeskTopIdeaProjectsOperationGamerProfileoutartifactsOperationGamerProfile_jar>java -jar OperationGamerProfile.jar
Thank you for choosing Operation Gamer Profile!
Please read the manual that was provided with this tool so that you know how to use it...
Lets get started...

The client ID is: (My client ID)
The client Secret is: (My client secret)
Please enter your authorization token(This is CASE SENSITIVE): (my token)
Result from blizzard: {"characters":[{"name":"Netherfry","realm":"Bleeding Hollow","battlegroup":"Ruin","class":5,"race":8,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"bleeding-hollow/27/163571995-avatar.jpg","lastModified":0},{"name":"Netherwarz","realm":"Darkspear","battlegroup":"Cyclone","class":9,"race":5,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"darkspear/130/86434434-avatar.jpg","guild":"GeekyGaming","guildRealm":"Darkspear","lastModified":0},{"name":"Hailnether","realm":"Akama","battlegroup":"Reckoning","class":1,"race":2,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"akama/235/95051243-avatar.jpg","lastModified":0},{"name":"Hailnether","realm":"Khaz Modan","battlegroup":"Cyclone","class":2,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"khaz-modan/53/101812021-avatar.jpg","lastModified":0},{"name":"Hailne6EA459","realm":"Greymane","battlegroup":"Shadowburn","class":5,"race":11,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"greymane/89/91137113-avatar.jpg","lastModified":0},{"name":"Netherdrew","realm":"Bleeding Hollow","battlegroup":"Ruin","class":11,"race":8,"gender":0,"level":91,"achievementPoints":1470,"thumbnail":"bleeding-hollow/134/156092806-avatar.jpg","spec":{"name":"Guardian","role":"TANK","backgroundImage":"bg-druid-bear","icon":"ability_racial_bearform","description":"Takes on the form of a mighty bear to absorb damage and protect allies.rnrnPreferred Weapon: Staff, Polearm","order":2},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1429907056000},{"name":"Hailnether","realm":"Wyrmrest Accord","battlegroup":"Cyclone","class":3,"race":4,"gender":0,"level":3,"achievementPoints":0,"thumbnail":"wyrmrest-accord/146/109003154-avatar.jpg","lastModified":0},{"name":"Netherwraith","realm":"Bleeding Hollow","battlegroup":"Ruin","class":9,"race":10,"gender":0,"level":16,"achievementPoints":1305,"thumbnail":"bleeding-hollow/72/157163336-avatar.jpg","spec":{"name":"Affliction","role":"DPS","backgroundImage":"bg-warlock-affliction","icon":"spell_shadow_deathcoil","description":"A master of shadow magic who specializes in drains and damage-over-time spells.rnrnPreferred Weapon: Staff, Wand, Dagger, Sword","order":0},"lastModified":1411674035000},{"name":"Nethermonk","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/13/157523981-avatar.jpg","lastModified":0},{"name":"Netherhunt","realm":"Bleeding Hollow","battlegroup":"Ruin","class":3,"race":2,"gender":0,"level":11,"achievementPoints":1380,"thumbnail":"bleeding-hollow/245/163559157-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1425762452000},{"name":"Netherlock","realm":"Cho'gall","battlegroup":"Vindication","class":9,"race":10,"gender":0,"level":16,"achievementPoints":0,"thumbnail":"chogall/88/110060376-avatar.jpg","guild":"Mindless","guildRealm":"Cho'gall","lastModified":0},{"name":"Bi?¬zzard","realm":"Bloodhoof","battlegroup":"Ruin","class":1,"race":2,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bloodhoof/42/108061994-avatar.jpg","lastModified":0},{"name":"Netherman","realm":"Cho'gall","battlegroup":"Vindication","class":3,"race":10,"gender":0,"level":20,"achievementPoints":1370,"thumbnail":"chogall/223/109983711-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"IliilBARCODEliilI","guildRealm":"Cho'gall","lastModified":1425698021000},{"name":"Yoursbaby","realm":"Moon Guard","battlegroup":"Reckoning","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"moon-guard/213/116473301-avatar.jpg","lastModified":0},{"name":"Hailne652387","realm":"Bladefist","battlegroup":"Vengeance","class":5,"race":11,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"bladefist/135/107291527-avatar.jpg","lastModified":0},{"name":"Aazzdf","realm":"Bleeding Hollow","battlegroup":"Ruin","class":1,"race":2,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/145/164662417-avatar.jpg","lastModified":0},{"name":"Nethersquad","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"bleeding-hollow/36/157524004-avatar.jpg","lastModified":0},{"name":"Darknether","realm":"Bleeding Hollow","battlegroup":"Ruin","class":6,"race":10,"gender":0,"level":62,"achievementPoints":1380,"thumbnail":"bleeding-hollow/118/156625270-avatar.jpg","spec":{"name":"Unholy","role":"DPS","backgroundImage":"bg-deathknight-unholy","icon":"spell_deathknight_unholypresence","description":"A master of death and decay, spreading infection and controlling undead minions to do his bidding.rnrnPreferred Weapon: Two-Handed Axe, Mace, Sword","order":2},"lastModified":1425841594000},{"name":"Lpeodke","realm":"Hellscream","battlegroup":"Rampage","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"hellscream/115/106721395-avatar.jpg","lastModified":0}]}

Starting JSONObjects
java.lang.IllegalArgumentException
at sun.net.www.ParseUtil.decode(Unknown Source)
at sun.misc.URLClassPath$JarLoader.<init>(Unknown Source)
at sun.misc.URLClassPath$3.run(Unknown Source)
at sun.misc.URLClassPath$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getNextLoader(Unknown Source)
at sun.misc.URLClassPath.getResource(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.OperationGamerProfile.Main.main(Main.java:52)

C:UsersDeskTopIdeaProjectsOperationGamerProfileoutartifactsOperationGamerProfile_jar>


Here is the htmlGetRequest method:



private static String htmlGetRequest(String urlToRead) throws Exception {
StringBuilder result = new StringBuilder();
URL url = new URL(urlToRead);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
result.append(line);
}
rd.close();
return result.toString();
}


Here is the code with the JSON:



try {
//getting data
String result = htmlGetRequest(url);
System.out.println("Result: " + result);
System.out.println();

System.out.println("Starting JSONObjects");

***//ERROR STARTS HERE***
JSONObject jsonobject = new JSONObject(result);

System.out.println("Built object");

JSONArray jsonArray = jsonobject.getJSONArray("characters");

System.out.println("Built Array");

for (int i = 0; i < jsonArray.length(); i++) {
JSONObject explrObject = jsonArray.getJSONObject(i);
String gender;
if (explrObject.get("gender").toString().equals("0")) {
gender = "Male";
} else {
gender = "Female";
}

String charClass = "";
switch(explrObject.get("class").toString()) {
case "1": charClass = "Warrior"; break;
case "2": charClass = "Paladin"; break;
case "3": charClass = "Hunter"; break;
case "4": charClass = "Rogue"; break;
case "5": charClass = "Priest"; break;
case "6": charClass = "Death Knight"; break;
case "7": charClass = "Shaman"; break;
case "9": charClass = "Mage"; break;
case "8": charClass = "Warlock"; break;
case "10": charClass = "Monk"; break;
case "11": charClass = "Druid"; break;
case "12": charClass = "Demon Hunter"; break;
}
System.out.printf("Information of character %d:n" +
"t Name: %sn" +
"t Level: %sn" +
"t Gender: %sn" +
"t Class: %sn"
, i+1, explrObject.get("name"), explrObject.get("level"), gender, charClass);
System.out.println();
}

System.out.println("Done displaying JSON Data...nExiting program...");

} catch(Exception e) {
e.printStackTrace();
}


At first I was getting NoClassDefFoundError, and ended up finding the classpath in IntelliJ and pasted this into it: "set classpath=%classpath%;.;", that seemed to fix the problem of the class not being found, but led to the error of IllegalArgumentException.



If anyone is able to help here, I would greatly appreciate it, if you need anymore details of the program, I am happy to provide them.



result contains: Result from blizzard:



{"characters":[{"name":"Netherfry","realm":"Bleeding Hollow","battlegroup":"Ruin","class":5,"race":8,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"bleeding-hollow/27/163571995-avatar.jpg","lastModified":0},{"name":"Netherwarz","realm":"Darkspear","battlegroup":"Cyclone","class":9,"race":5,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"darkspear/130/86434434-avatar.jpg","guild":"GeekyGaming","guildRealm":"Darkspear","lastModified":0},{"name":"Hailnether","realm":"Akama","battlegroup":"Reckoning","class":1,"race":2,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"akama/235/95051243-avatar.jpg","lastModified":0},{"name":"Hailnether","realm":"Khaz Modan","battlegroup":"Cyclone","class":2,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"khaz-modan/53/101812021-avatar.jpg","lastModified":0},{"name":"Hailne6EA459","realm":"Greymane","battlegroup":"Shadowburn","class":5,"race":11,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"greymane/89/91137113-avatar.jpg","lastModified":0},{"name":"Netherdrew","realm":"Bleeding Hollow","battlegroup":"Ruin","class":11,"race":8,"gender":0,"level":91,"achievementPoints":1470,"thumbnail":"bleeding-hollow/134/156092806-avatar.jpg","spec":{"name":"Guardian","role":"TANK","backgroundImage":"bg-druid-bear","icon":"ability_racial_bearform","description":"Takes on the form of a mighty bear to absorb damage and protect allies.rnrnPreferred Weapon: Staff, Polearm","order":2},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1429907056000},{"name":"Hailnether","realm":"Wyrmrest Accord","battlegroup":"Cyclone","class":3,"race":4,"gender":0,"level":3,"achievementPoints":0,"thumbnail":"wyrmrest-accord/146/109003154-avatar.jpg","lastModified":0},{"name":"Nethermonk","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/13/157523981-avatar.jpg","lastModified":0},{"name":"Netherwraith","realm":"Bleeding Hollow","battlegroup":"Ruin","class":9,"race":10,"gender":0,"level":16,"achievementPoints":1305,"thumbnail":"bleeding-hollow/72/157163336-avatar.jpg","spec":{"name":"Affliction","role":"DPS","backgroundImage":"bg-warlock-affliction","icon":"spell_shadow_deathcoil","description":"A master of shadow magic who specializes in drains and damage-over-time spells.rnrnPreferred Weapon: Staff, Wand, Dagger, Sword","order":0},"lastModified":1411674035000},{"name":"Netherhunt","realm":"Bleeding Hollow","battlegroup":"Ruin","class":3,"race":2,"gender":0,"level":11,"achievementPoints":1380,"thumbnail":"bleeding-hollow/245/163559157-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1425762452000},{"name":"Netherlock","realm":"Cho'gall","battlegroup":"Vindication","class":9,"race":10,"gender":0,"level":16,"achievementPoints":0,"thumbnail":"chogall/88/110060376-avatar.jpg","guild":"Mindless","guildRealm":"Cho'gall","lastModified":0},{"name":"Biìzzard","realm":"Bloodhoof","battlegroup":"Ruin","class":1,"race":2,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bloodhoof/42/108061994-avatar.jpg","lastModified":0},{"name":"Netherman","realm":"Cho'gall","battlegroup":"Vindication","class":3,"race":10,"gender":0,"level":20,"achievementPoints":1370,"thumbnail":"chogall/223/109983711-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"IliilBARCODEliilI","guildRealm":"Cho'gall","lastModified":1425698021000},{"name":"Yoursbaby","realm":"Moon Guard","battlegroup":"Reckoning","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"moon-guard/213/116473301-avatar.jpg","lastModified":0},{"name":"Hailne652387","realm":"Bladefist","battlegroup":"Vengeance","class":5,"race":11,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"bladefist/135/107291527-avatar.jpg","lastModified":0},{"name":"Aazzdf","realm":"Bleeding Hollow","battlegroup":"Ruin","class":1,"race":2,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/145/164662417-avatar.jpg","lastModified":0},{"name":"Nethersquad","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"bleeding-hollow/36/157524004-avatar.jpg","lastModified":0},{"name":"Darknether","realm":"Bleeding Hollow","battlegroup":"Ruin","class":6,"race":10,"gender":0,"level":62,"achievementPoints":1380,"thumbnail":"bleeding-hollow/118/156625270-avatar.jpg","spec":{"name":"Unholy","role":"DPS","backgroundImage":"bg-deathknight-unholy","icon":"spell_deathknight_unholypresence","description":"A master of death and decay, spreading infection and controlling undead minions to do her bidding.rnrnPreferred Weapon: Two-Handed Axe, Mace, Sword","order":2},"lastModified":1425841594000},{"name":"Lpeodke","realm":"Hellscream","battlegroup":"Rampage","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"hellscream/115/106721395-avatar.jpg","lastModified":0}]}`


Sorry for the spaghetti code...










share|improve this question




















  • 1





    Please copy the stacktrace from cmd to your post and remove the attached picture.

    – samabcde
    Nov 26 '18 at 2:25











  • @samabcde Done :)

    – Tyler
    Nov 26 '18 at 17:50











  • Is result really a parseable json string? If so, you should probably change the name of the getHTML method.

    – The Head Rush
    Nov 26 '18 at 18:01











  • @TheHeadRush Oh, I see how that could be a confusing name. getHTML is going to blizzard and requesting my character list from them. I'll edit the post and give you the contents of result at the bottom of it.

    – Tyler
    Nov 26 '18 at 18:04













  • @TheHeadRush I'm going to change getHTML to htmlGetRequest, because it is a get request, thanks for the input on that. :)

    – Tyler
    Nov 26 '18 at 18:10














0












0








0








I have built a program in java, and running it in IntelliJ is fine, but when I build the artifact (jar) and run it in the command prompt on my computer, it throws the IllegalArgumentException.



I am using java-json.jar as my library to make a string (that is in JSON form) into a JSON object so that I can iterate through it and display the information as needed.



Here are the results of running the program in CMD:



    C:UsersDeskTopIdeaProjectsOperationGamerProfileoutartifactsOperationGamerProfile_jar>java -jar OperationGamerProfile.jar
Thank you for choosing Operation Gamer Profile!
Please read the manual that was provided with this tool so that you know how to use it...
Lets get started...

The client ID is: (My client ID)
The client Secret is: (My client secret)
Please enter your authorization token(This is CASE SENSITIVE): (my token)
Result from blizzard: {"characters":[{"name":"Netherfry","realm":"Bleeding Hollow","battlegroup":"Ruin","class":5,"race":8,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"bleeding-hollow/27/163571995-avatar.jpg","lastModified":0},{"name":"Netherwarz","realm":"Darkspear","battlegroup":"Cyclone","class":9,"race":5,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"darkspear/130/86434434-avatar.jpg","guild":"GeekyGaming","guildRealm":"Darkspear","lastModified":0},{"name":"Hailnether","realm":"Akama","battlegroup":"Reckoning","class":1,"race":2,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"akama/235/95051243-avatar.jpg","lastModified":0},{"name":"Hailnether","realm":"Khaz Modan","battlegroup":"Cyclone","class":2,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"khaz-modan/53/101812021-avatar.jpg","lastModified":0},{"name":"Hailne6EA459","realm":"Greymane","battlegroup":"Shadowburn","class":5,"race":11,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"greymane/89/91137113-avatar.jpg","lastModified":0},{"name":"Netherdrew","realm":"Bleeding Hollow","battlegroup":"Ruin","class":11,"race":8,"gender":0,"level":91,"achievementPoints":1470,"thumbnail":"bleeding-hollow/134/156092806-avatar.jpg","spec":{"name":"Guardian","role":"TANK","backgroundImage":"bg-druid-bear","icon":"ability_racial_bearform","description":"Takes on the form of a mighty bear to absorb damage and protect allies.rnrnPreferred Weapon: Staff, Polearm","order":2},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1429907056000},{"name":"Hailnether","realm":"Wyrmrest Accord","battlegroup":"Cyclone","class":3,"race":4,"gender":0,"level":3,"achievementPoints":0,"thumbnail":"wyrmrest-accord/146/109003154-avatar.jpg","lastModified":0},{"name":"Netherwraith","realm":"Bleeding Hollow","battlegroup":"Ruin","class":9,"race":10,"gender":0,"level":16,"achievementPoints":1305,"thumbnail":"bleeding-hollow/72/157163336-avatar.jpg","spec":{"name":"Affliction","role":"DPS","backgroundImage":"bg-warlock-affliction","icon":"spell_shadow_deathcoil","description":"A master of shadow magic who specializes in drains and damage-over-time spells.rnrnPreferred Weapon: Staff, Wand, Dagger, Sword","order":0},"lastModified":1411674035000},{"name":"Nethermonk","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/13/157523981-avatar.jpg","lastModified":0},{"name":"Netherhunt","realm":"Bleeding Hollow","battlegroup":"Ruin","class":3,"race":2,"gender":0,"level":11,"achievementPoints":1380,"thumbnail":"bleeding-hollow/245/163559157-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1425762452000},{"name":"Netherlock","realm":"Cho'gall","battlegroup":"Vindication","class":9,"race":10,"gender":0,"level":16,"achievementPoints":0,"thumbnail":"chogall/88/110060376-avatar.jpg","guild":"Mindless","guildRealm":"Cho'gall","lastModified":0},{"name":"Bi?¬zzard","realm":"Bloodhoof","battlegroup":"Ruin","class":1,"race":2,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bloodhoof/42/108061994-avatar.jpg","lastModified":0},{"name":"Netherman","realm":"Cho'gall","battlegroup":"Vindication","class":3,"race":10,"gender":0,"level":20,"achievementPoints":1370,"thumbnail":"chogall/223/109983711-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"IliilBARCODEliilI","guildRealm":"Cho'gall","lastModified":1425698021000},{"name":"Yoursbaby","realm":"Moon Guard","battlegroup":"Reckoning","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"moon-guard/213/116473301-avatar.jpg","lastModified":0},{"name":"Hailne652387","realm":"Bladefist","battlegroup":"Vengeance","class":5,"race":11,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"bladefist/135/107291527-avatar.jpg","lastModified":0},{"name":"Aazzdf","realm":"Bleeding Hollow","battlegroup":"Ruin","class":1,"race":2,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/145/164662417-avatar.jpg","lastModified":0},{"name":"Nethersquad","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"bleeding-hollow/36/157524004-avatar.jpg","lastModified":0},{"name":"Darknether","realm":"Bleeding Hollow","battlegroup":"Ruin","class":6,"race":10,"gender":0,"level":62,"achievementPoints":1380,"thumbnail":"bleeding-hollow/118/156625270-avatar.jpg","spec":{"name":"Unholy","role":"DPS","backgroundImage":"bg-deathknight-unholy","icon":"spell_deathknight_unholypresence","description":"A master of death and decay, spreading infection and controlling undead minions to do his bidding.rnrnPreferred Weapon: Two-Handed Axe, Mace, Sword","order":2},"lastModified":1425841594000},{"name":"Lpeodke","realm":"Hellscream","battlegroup":"Rampage","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"hellscream/115/106721395-avatar.jpg","lastModified":0}]}

Starting JSONObjects
java.lang.IllegalArgumentException
at sun.net.www.ParseUtil.decode(Unknown Source)
at sun.misc.URLClassPath$JarLoader.<init>(Unknown Source)
at sun.misc.URLClassPath$3.run(Unknown Source)
at sun.misc.URLClassPath$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getNextLoader(Unknown Source)
at sun.misc.URLClassPath.getResource(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.OperationGamerProfile.Main.main(Main.java:52)

C:UsersDeskTopIdeaProjectsOperationGamerProfileoutartifactsOperationGamerProfile_jar>


Here is the htmlGetRequest method:



private static String htmlGetRequest(String urlToRead) throws Exception {
StringBuilder result = new StringBuilder();
URL url = new URL(urlToRead);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
result.append(line);
}
rd.close();
return result.toString();
}


Here is the code with the JSON:



try {
//getting data
String result = htmlGetRequest(url);
System.out.println("Result: " + result);
System.out.println();

System.out.println("Starting JSONObjects");

***//ERROR STARTS HERE***
JSONObject jsonobject = new JSONObject(result);

System.out.println("Built object");

JSONArray jsonArray = jsonobject.getJSONArray("characters");

System.out.println("Built Array");

for (int i = 0; i < jsonArray.length(); i++) {
JSONObject explrObject = jsonArray.getJSONObject(i);
String gender;
if (explrObject.get("gender").toString().equals("0")) {
gender = "Male";
} else {
gender = "Female";
}

String charClass = "";
switch(explrObject.get("class").toString()) {
case "1": charClass = "Warrior"; break;
case "2": charClass = "Paladin"; break;
case "3": charClass = "Hunter"; break;
case "4": charClass = "Rogue"; break;
case "5": charClass = "Priest"; break;
case "6": charClass = "Death Knight"; break;
case "7": charClass = "Shaman"; break;
case "9": charClass = "Mage"; break;
case "8": charClass = "Warlock"; break;
case "10": charClass = "Monk"; break;
case "11": charClass = "Druid"; break;
case "12": charClass = "Demon Hunter"; break;
}
System.out.printf("Information of character %d:n" +
"t Name: %sn" +
"t Level: %sn" +
"t Gender: %sn" +
"t Class: %sn"
, i+1, explrObject.get("name"), explrObject.get("level"), gender, charClass);
System.out.println();
}

System.out.println("Done displaying JSON Data...nExiting program...");

} catch(Exception e) {
e.printStackTrace();
}


At first I was getting NoClassDefFoundError, and ended up finding the classpath in IntelliJ and pasted this into it: "set classpath=%classpath%;.;", that seemed to fix the problem of the class not being found, but led to the error of IllegalArgumentException.



If anyone is able to help here, I would greatly appreciate it, if you need anymore details of the program, I am happy to provide them.



result contains: Result from blizzard:



{"characters":[{"name":"Netherfry","realm":"Bleeding Hollow","battlegroup":"Ruin","class":5,"race":8,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"bleeding-hollow/27/163571995-avatar.jpg","lastModified":0},{"name":"Netherwarz","realm":"Darkspear","battlegroup":"Cyclone","class":9,"race":5,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"darkspear/130/86434434-avatar.jpg","guild":"GeekyGaming","guildRealm":"Darkspear","lastModified":0},{"name":"Hailnether","realm":"Akama","battlegroup":"Reckoning","class":1,"race":2,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"akama/235/95051243-avatar.jpg","lastModified":0},{"name":"Hailnether","realm":"Khaz Modan","battlegroup":"Cyclone","class":2,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"khaz-modan/53/101812021-avatar.jpg","lastModified":0},{"name":"Hailne6EA459","realm":"Greymane","battlegroup":"Shadowburn","class":5,"race":11,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"greymane/89/91137113-avatar.jpg","lastModified":0},{"name":"Netherdrew","realm":"Bleeding Hollow","battlegroup":"Ruin","class":11,"race":8,"gender":0,"level":91,"achievementPoints":1470,"thumbnail":"bleeding-hollow/134/156092806-avatar.jpg","spec":{"name":"Guardian","role":"TANK","backgroundImage":"bg-druid-bear","icon":"ability_racial_bearform","description":"Takes on the form of a mighty bear to absorb damage and protect allies.rnrnPreferred Weapon: Staff, Polearm","order":2},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1429907056000},{"name":"Hailnether","realm":"Wyrmrest Accord","battlegroup":"Cyclone","class":3,"race":4,"gender":0,"level":3,"achievementPoints":0,"thumbnail":"wyrmrest-accord/146/109003154-avatar.jpg","lastModified":0},{"name":"Nethermonk","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/13/157523981-avatar.jpg","lastModified":0},{"name":"Netherwraith","realm":"Bleeding Hollow","battlegroup":"Ruin","class":9,"race":10,"gender":0,"level":16,"achievementPoints":1305,"thumbnail":"bleeding-hollow/72/157163336-avatar.jpg","spec":{"name":"Affliction","role":"DPS","backgroundImage":"bg-warlock-affliction","icon":"spell_shadow_deathcoil","description":"A master of shadow magic who specializes in drains and damage-over-time spells.rnrnPreferred Weapon: Staff, Wand, Dagger, Sword","order":0},"lastModified":1411674035000},{"name":"Netherhunt","realm":"Bleeding Hollow","battlegroup":"Ruin","class":3,"race":2,"gender":0,"level":11,"achievementPoints":1380,"thumbnail":"bleeding-hollow/245/163559157-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1425762452000},{"name":"Netherlock","realm":"Cho'gall","battlegroup":"Vindication","class":9,"race":10,"gender":0,"level":16,"achievementPoints":0,"thumbnail":"chogall/88/110060376-avatar.jpg","guild":"Mindless","guildRealm":"Cho'gall","lastModified":0},{"name":"Biìzzard","realm":"Bloodhoof","battlegroup":"Ruin","class":1,"race":2,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bloodhoof/42/108061994-avatar.jpg","lastModified":0},{"name":"Netherman","realm":"Cho'gall","battlegroup":"Vindication","class":3,"race":10,"gender":0,"level":20,"achievementPoints":1370,"thumbnail":"chogall/223/109983711-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"IliilBARCODEliilI","guildRealm":"Cho'gall","lastModified":1425698021000},{"name":"Yoursbaby","realm":"Moon Guard","battlegroup":"Reckoning","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"moon-guard/213/116473301-avatar.jpg","lastModified":0},{"name":"Hailne652387","realm":"Bladefist","battlegroup":"Vengeance","class":5,"race":11,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"bladefist/135/107291527-avatar.jpg","lastModified":0},{"name":"Aazzdf","realm":"Bleeding Hollow","battlegroup":"Ruin","class":1,"race":2,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/145/164662417-avatar.jpg","lastModified":0},{"name":"Nethersquad","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"bleeding-hollow/36/157524004-avatar.jpg","lastModified":0},{"name":"Darknether","realm":"Bleeding Hollow","battlegroup":"Ruin","class":6,"race":10,"gender":0,"level":62,"achievementPoints":1380,"thumbnail":"bleeding-hollow/118/156625270-avatar.jpg","spec":{"name":"Unholy","role":"DPS","backgroundImage":"bg-deathknight-unholy","icon":"spell_deathknight_unholypresence","description":"A master of death and decay, spreading infection and controlling undead minions to do her bidding.rnrnPreferred Weapon: Two-Handed Axe, Mace, Sword","order":2},"lastModified":1425841594000},{"name":"Lpeodke","realm":"Hellscream","battlegroup":"Rampage","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"hellscream/115/106721395-avatar.jpg","lastModified":0}]}`


Sorry for the spaghetti code...










share|improve this question
















I have built a program in java, and running it in IntelliJ is fine, but when I build the artifact (jar) and run it in the command prompt on my computer, it throws the IllegalArgumentException.



I am using java-json.jar as my library to make a string (that is in JSON form) into a JSON object so that I can iterate through it and display the information as needed.



Here are the results of running the program in CMD:



    C:UsersDeskTopIdeaProjectsOperationGamerProfileoutartifactsOperationGamerProfile_jar>java -jar OperationGamerProfile.jar
Thank you for choosing Operation Gamer Profile!
Please read the manual that was provided with this tool so that you know how to use it...
Lets get started...

The client ID is: (My client ID)
The client Secret is: (My client secret)
Please enter your authorization token(This is CASE SENSITIVE): (my token)
Result from blizzard: {"characters":[{"name":"Netherfry","realm":"Bleeding Hollow","battlegroup":"Ruin","class":5,"race":8,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"bleeding-hollow/27/163571995-avatar.jpg","lastModified":0},{"name":"Netherwarz","realm":"Darkspear","battlegroup":"Cyclone","class":9,"race":5,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"darkspear/130/86434434-avatar.jpg","guild":"GeekyGaming","guildRealm":"Darkspear","lastModified":0},{"name":"Hailnether","realm":"Akama","battlegroup":"Reckoning","class":1,"race":2,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"akama/235/95051243-avatar.jpg","lastModified":0},{"name":"Hailnether","realm":"Khaz Modan","battlegroup":"Cyclone","class":2,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"khaz-modan/53/101812021-avatar.jpg","lastModified":0},{"name":"Hailne6EA459","realm":"Greymane","battlegroup":"Shadowburn","class":5,"race":11,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"greymane/89/91137113-avatar.jpg","lastModified":0},{"name":"Netherdrew","realm":"Bleeding Hollow","battlegroup":"Ruin","class":11,"race":8,"gender":0,"level":91,"achievementPoints":1470,"thumbnail":"bleeding-hollow/134/156092806-avatar.jpg","spec":{"name":"Guardian","role":"TANK","backgroundImage":"bg-druid-bear","icon":"ability_racial_bearform","description":"Takes on the form of a mighty bear to absorb damage and protect allies.rnrnPreferred Weapon: Staff, Polearm","order":2},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1429907056000},{"name":"Hailnether","realm":"Wyrmrest Accord","battlegroup":"Cyclone","class":3,"race":4,"gender":0,"level":3,"achievementPoints":0,"thumbnail":"wyrmrest-accord/146/109003154-avatar.jpg","lastModified":0},{"name":"Netherwraith","realm":"Bleeding Hollow","battlegroup":"Ruin","class":9,"race":10,"gender":0,"level":16,"achievementPoints":1305,"thumbnail":"bleeding-hollow/72/157163336-avatar.jpg","spec":{"name":"Affliction","role":"DPS","backgroundImage":"bg-warlock-affliction","icon":"spell_shadow_deathcoil","description":"A master of shadow magic who specializes in drains and damage-over-time spells.rnrnPreferred Weapon: Staff, Wand, Dagger, Sword","order":0},"lastModified":1411674035000},{"name":"Nethermonk","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/13/157523981-avatar.jpg","lastModified":0},{"name":"Netherhunt","realm":"Bleeding Hollow","battlegroup":"Ruin","class":3,"race":2,"gender":0,"level":11,"achievementPoints":1380,"thumbnail":"bleeding-hollow/245/163559157-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1425762452000},{"name":"Netherlock","realm":"Cho'gall","battlegroup":"Vindication","class":9,"race":10,"gender":0,"level":16,"achievementPoints":0,"thumbnail":"chogall/88/110060376-avatar.jpg","guild":"Mindless","guildRealm":"Cho'gall","lastModified":0},{"name":"Bi?¬zzard","realm":"Bloodhoof","battlegroup":"Ruin","class":1,"race":2,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bloodhoof/42/108061994-avatar.jpg","lastModified":0},{"name":"Netherman","realm":"Cho'gall","battlegroup":"Vindication","class":3,"race":10,"gender":0,"level":20,"achievementPoints":1370,"thumbnail":"chogall/223/109983711-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"IliilBARCODEliilI","guildRealm":"Cho'gall","lastModified":1425698021000},{"name":"Yoursbaby","realm":"Moon Guard","battlegroup":"Reckoning","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"moon-guard/213/116473301-avatar.jpg","lastModified":0},{"name":"Hailne652387","realm":"Bladefist","battlegroup":"Vengeance","class":5,"race":11,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"bladefist/135/107291527-avatar.jpg","lastModified":0},{"name":"Aazzdf","realm":"Bleeding Hollow","battlegroup":"Ruin","class":1,"race":2,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/145/164662417-avatar.jpg","lastModified":0},{"name":"Nethersquad","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"bleeding-hollow/36/157524004-avatar.jpg","lastModified":0},{"name":"Darknether","realm":"Bleeding Hollow","battlegroup":"Ruin","class":6,"race":10,"gender":0,"level":62,"achievementPoints":1380,"thumbnail":"bleeding-hollow/118/156625270-avatar.jpg","spec":{"name":"Unholy","role":"DPS","backgroundImage":"bg-deathknight-unholy","icon":"spell_deathknight_unholypresence","description":"A master of death and decay, spreading infection and controlling undead minions to do his bidding.rnrnPreferred Weapon: Two-Handed Axe, Mace, Sword","order":2},"lastModified":1425841594000},{"name":"Lpeodke","realm":"Hellscream","battlegroup":"Rampage","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"hellscream/115/106721395-avatar.jpg","lastModified":0}]}

Starting JSONObjects
java.lang.IllegalArgumentException
at sun.net.www.ParseUtil.decode(Unknown Source)
at sun.misc.URLClassPath$JarLoader.<init>(Unknown Source)
at sun.misc.URLClassPath$3.run(Unknown Source)
at sun.misc.URLClassPath$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getNextLoader(Unknown Source)
at sun.misc.URLClassPath.getResource(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.OperationGamerProfile.Main.main(Main.java:52)

C:UsersDeskTopIdeaProjectsOperationGamerProfileoutartifactsOperationGamerProfile_jar>


Here is the htmlGetRequest method:



private static String htmlGetRequest(String urlToRead) throws Exception {
StringBuilder result = new StringBuilder();
URL url = new URL(urlToRead);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
result.append(line);
}
rd.close();
return result.toString();
}


Here is the code with the JSON:



try {
//getting data
String result = htmlGetRequest(url);
System.out.println("Result: " + result);
System.out.println();

System.out.println("Starting JSONObjects");

***//ERROR STARTS HERE***
JSONObject jsonobject = new JSONObject(result);

System.out.println("Built object");

JSONArray jsonArray = jsonobject.getJSONArray("characters");

System.out.println("Built Array");

for (int i = 0; i < jsonArray.length(); i++) {
JSONObject explrObject = jsonArray.getJSONObject(i);
String gender;
if (explrObject.get("gender").toString().equals("0")) {
gender = "Male";
} else {
gender = "Female";
}

String charClass = "";
switch(explrObject.get("class").toString()) {
case "1": charClass = "Warrior"; break;
case "2": charClass = "Paladin"; break;
case "3": charClass = "Hunter"; break;
case "4": charClass = "Rogue"; break;
case "5": charClass = "Priest"; break;
case "6": charClass = "Death Knight"; break;
case "7": charClass = "Shaman"; break;
case "9": charClass = "Mage"; break;
case "8": charClass = "Warlock"; break;
case "10": charClass = "Monk"; break;
case "11": charClass = "Druid"; break;
case "12": charClass = "Demon Hunter"; break;
}
System.out.printf("Information of character %d:n" +
"t Name: %sn" +
"t Level: %sn" +
"t Gender: %sn" +
"t Class: %sn"
, i+1, explrObject.get("name"), explrObject.get("level"), gender, charClass);
System.out.println();
}

System.out.println("Done displaying JSON Data...nExiting program...");

} catch(Exception e) {
e.printStackTrace();
}


At first I was getting NoClassDefFoundError, and ended up finding the classpath in IntelliJ and pasted this into it: "set classpath=%classpath%;.;", that seemed to fix the problem of the class not being found, but led to the error of IllegalArgumentException.



If anyone is able to help here, I would greatly appreciate it, if you need anymore details of the program, I am happy to provide them.



result contains: Result from blizzard:



{"characters":[{"name":"Netherfry","realm":"Bleeding Hollow","battlegroup":"Ruin","class":5,"race":8,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"bleeding-hollow/27/163571995-avatar.jpg","lastModified":0},{"name":"Netherwarz","realm":"Darkspear","battlegroup":"Cyclone","class":9,"race":5,"gender":0,"level":5,"achievementPoints":0,"thumbnail":"darkspear/130/86434434-avatar.jpg","guild":"GeekyGaming","guildRealm":"Darkspear","lastModified":0},{"name":"Hailnether","realm":"Akama","battlegroup":"Reckoning","class":1,"race":2,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"akama/235/95051243-avatar.jpg","lastModified":0},{"name":"Hailnether","realm":"Khaz Modan","battlegroup":"Cyclone","class":2,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"khaz-modan/53/101812021-avatar.jpg","lastModified":0},{"name":"Hailne6EA459","realm":"Greymane","battlegroup":"Shadowburn","class":5,"race":11,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"greymane/89/91137113-avatar.jpg","lastModified":0},{"name":"Netherdrew","realm":"Bleeding Hollow","battlegroup":"Ruin","class":11,"race":8,"gender":0,"level":91,"achievementPoints":1470,"thumbnail":"bleeding-hollow/134/156092806-avatar.jpg","spec":{"name":"Guardian","role":"TANK","backgroundImage":"bg-druid-bear","icon":"ability_racial_bearform","description":"Takes on the form of a mighty bear to absorb damage and protect allies.rnrnPreferred Weapon: Staff, Polearm","order":2},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1429907056000},{"name":"Hailnether","realm":"Wyrmrest Accord","battlegroup":"Cyclone","class":3,"race":4,"gender":0,"level":3,"achievementPoints":0,"thumbnail":"wyrmrest-accord/146/109003154-avatar.jpg","lastModified":0},{"name":"Nethermonk","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/13/157523981-avatar.jpg","lastModified":0},{"name":"Netherwraith","realm":"Bleeding Hollow","battlegroup":"Ruin","class":9,"race":10,"gender":0,"level":16,"achievementPoints":1305,"thumbnail":"bleeding-hollow/72/157163336-avatar.jpg","spec":{"name":"Affliction","role":"DPS","backgroundImage":"bg-warlock-affliction","icon":"spell_shadow_deathcoil","description":"A master of shadow magic who specializes in drains and damage-over-time spells.rnrnPreferred Weapon: Staff, Wand, Dagger, Sword","order":0},"lastModified":1411674035000},{"name":"Netherhunt","realm":"Bleeding Hollow","battlegroup":"Ruin","class":3,"race":2,"gender":0,"level":11,"achievementPoints":1380,"thumbnail":"bleeding-hollow/245/163559157-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"EndlessVoid","guildRealm":"Bleeding Hollow","lastModified":1425762452000},{"name":"Netherlock","realm":"Cho'gall","battlegroup":"Vindication","class":9,"race":10,"gender":0,"level":16,"achievementPoints":0,"thumbnail":"chogall/88/110060376-avatar.jpg","guild":"Mindless","guildRealm":"Cho'gall","lastModified":0},{"name":"Biìzzard","realm":"Bloodhoof","battlegroup":"Ruin","class":1,"race":2,"gender":0,"level":1,"achievementPoints":0,"thumbnail":"bloodhoof/42/108061994-avatar.jpg","lastModified":0},{"name":"Netherman","realm":"Cho'gall","battlegroup":"Vindication","class":3,"race":10,"gender":0,"level":20,"achievementPoints":1370,"thumbnail":"chogall/223/109983711-avatar.jpg","spec":{"name":"Marksmanship","role":"DPS","backgroundImage":"bg-hunter-marksman","icon":"ability_hunter_focusedaim","description":"A master sharpshooter who excels in bringing down enemies from afar.rnrnPreferred Weapon: Bow, Crossbow, Gun","order":1},"guild":"IliilBARCODEliilI","guildRealm":"Cho'gall","lastModified":1425698021000},{"name":"Yoursbaby","realm":"Moon Guard","battlegroup":"Reckoning","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"moon-guard/213/116473301-avatar.jpg","lastModified":0},{"name":"Hailne652387","realm":"Bladefist","battlegroup":"Vengeance","class":5,"race":11,"gender":0,"level":2,"achievementPoints":0,"thumbnail":"bladefist/135/107291527-avatar.jpg","lastModified":0},{"name":"Aazzdf","realm":"Bleeding Hollow","battlegroup":"Ruin","class":1,"race":2,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"bleeding-hollow/145/164662417-avatar.jpg","lastModified":0},{"name":"Nethersquad","realm":"Bleeding Hollow","battlegroup":"Ruin","class":10,"race":10,"gender":0,"level":0,"achievementPoints":0,"thumbnail":"bleeding-hollow/36/157524004-avatar.jpg","lastModified":0},{"name":"Darknether","realm":"Bleeding Hollow","battlegroup":"Ruin","class":6,"race":10,"gender":0,"level":62,"achievementPoints":1380,"thumbnail":"bleeding-hollow/118/156625270-avatar.jpg","spec":{"name":"Unholy","role":"DPS","backgroundImage":"bg-deathknight-unholy","icon":"spell_deathknight_unholypresence","description":"A master of death and decay, spreading infection and controlling undead minions to do her bidding.rnrnPreferred Weapon: Two-Handed Axe, Mace, Sword","order":2},"lastModified":1425841594000},{"name":"Lpeodke","realm":"Hellscream","battlegroup":"Rampage","class":5,"race":1,"gender":1,"level":1,"achievementPoints":0,"thumbnail":"hellscream/115/106721395-avatar.jpg","lastModified":0}]}`


Sorry for the spaghetti code...







java json intellij-idea






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 18:18







Tyler

















asked Nov 26 '18 at 1:29









TylerTyler

115




115








  • 1





    Please copy the stacktrace from cmd to your post and remove the attached picture.

    – samabcde
    Nov 26 '18 at 2:25











  • @samabcde Done :)

    – Tyler
    Nov 26 '18 at 17:50











  • Is result really a parseable json string? If so, you should probably change the name of the getHTML method.

    – The Head Rush
    Nov 26 '18 at 18:01











  • @TheHeadRush Oh, I see how that could be a confusing name. getHTML is going to blizzard and requesting my character list from them. I'll edit the post and give you the contents of result at the bottom of it.

    – Tyler
    Nov 26 '18 at 18:04













  • @TheHeadRush I'm going to change getHTML to htmlGetRequest, because it is a get request, thanks for the input on that. :)

    – Tyler
    Nov 26 '18 at 18:10














  • 1





    Please copy the stacktrace from cmd to your post and remove the attached picture.

    – samabcde
    Nov 26 '18 at 2:25











  • @samabcde Done :)

    – Tyler
    Nov 26 '18 at 17:50











  • Is result really a parseable json string? If so, you should probably change the name of the getHTML method.

    – The Head Rush
    Nov 26 '18 at 18:01











  • @TheHeadRush Oh, I see how that could be a confusing name. getHTML is going to blizzard and requesting my character list from them. I'll edit the post and give you the contents of result at the bottom of it.

    – Tyler
    Nov 26 '18 at 18:04













  • @TheHeadRush I'm going to change getHTML to htmlGetRequest, because it is a get request, thanks for the input on that. :)

    – Tyler
    Nov 26 '18 at 18:10








1




1





Please copy the stacktrace from cmd to your post and remove the attached picture.

– samabcde
Nov 26 '18 at 2:25





Please copy the stacktrace from cmd to your post and remove the attached picture.

– samabcde
Nov 26 '18 at 2:25













@samabcde Done :)

– Tyler
Nov 26 '18 at 17:50





@samabcde Done :)

– Tyler
Nov 26 '18 at 17:50













Is result really a parseable json string? If so, you should probably change the name of the getHTML method.

– The Head Rush
Nov 26 '18 at 18:01





Is result really a parseable json string? If so, you should probably change the name of the getHTML method.

– The Head Rush
Nov 26 '18 at 18:01













@TheHeadRush Oh, I see how that could be a confusing name. getHTML is going to blizzard and requesting my character list from them. I'll edit the post and give you the contents of result at the bottom of it.

– Tyler
Nov 26 '18 at 18:04







@TheHeadRush Oh, I see how that could be a confusing name. getHTML is going to blizzard and requesting my character list from them. I'll edit the post and give you the contents of result at the bottom of it.

– Tyler
Nov 26 '18 at 18:04















@TheHeadRush I'm going to change getHTML to htmlGetRequest, because it is a get request, thanks for the input on that. :)

– Tyler
Nov 26 '18 at 18:10





@TheHeadRush I'm going to change getHTML to htmlGetRequest, because it is a get request, thanks for the input on that. :)

– Tyler
Nov 26 '18 at 18:10












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53473699%2frunning-a-jar-jsonobject-throwing-illegalargumentexception%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53473699%2frunning-a-jar-jsonobject-throwing-illegalargumentexception%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks