This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
hi, I get this error: class file has wrong version 50.0, should be 49.0
when trying to compile a servlet containing JSON code.. (any other servlets compile ok...)
I have json.jar in proper place (I even ran jar tf json.jar command, everything is there..) am running jdk1.5.0_18 and this is specified in JAVA_HOME...
don't know what's up with my tomcat/JSON.. also in JSP I can't run JSON code, get errors like
JSONObject cannot be resolved to a type
even though, again, json.jar is in its proper place, and proper directive is in JSP to import JSON classes...
he imports org.json.simple, where does he get THAT from, there's no class SIMPLE in org.json.. I changed that directive to just org.json.*, but still get errors...
I get this error: class file has wrong version 50.0, should be 49.0
That sounds like you're using a library that is compiled for use with Java 6, while you're using Java 5. Either recompile the library to work with Java 5 (assuming that's possible, but chances are that it is), or find another library that works with java 5 out of the box, or upgrade your JDK to Java 6.
even though, again, json.jar is in its proper place, and proper directive is in JSP to import JSON classes
By "proper place" you mean your web app's WEB-INF/lib directory, right? Post the JSP directive.
where does JSONValuecome from, I don't see JSONValue here ... he imports org.json.simple, where does he get THAT from, there's no class SIMPLE in org.json..
But in general, note this paragraph under "JSON parsers -> on the server-side", which I take to mean that you should adapt the code to whatever JSON library you happen to use:
Decode the incoming JSON string and convert the result to an object using a JSON parser for the language of your choice. At http://www.json.org, you'll find JSON parsers for many modern programming languages. The methods available depend upon which parser you are using. See the parser's documentation for details.
(and, again, I changed the import of org.json.simple.* to just org.json.* since org.json.simple.* doesn't make sense to me, but in both cases I get same error...)
thank you...
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
posted
0
Can you please provide the full error you're getting?
When are you getting this, during compilation? Is a stack trace provided? Can you please show this? (use code tags)
As far as the import goes, what is the fully-qualified package name of the objects you are referencing in your source file? That will tell you what you want for import statements. For example if the class you're referencing is com.company.product.MyClass, then you can use the following import: If you really want to, you can use glob characters in the import, so instead you could use the following:
If the class you're trying to reference needs an import which you don't have, you'll get a different error, so I don't think that's what's happening here (although your last posted error message was pretty vague, so I'm not sure).
org.json.simple.* didn't make sense to me, as I don't see a package "simple" here,
www.json.org/javadoc/index.html
in WEB-INF/lib/ I have json.jar, compiled by myself (from src code gotten from here, www.json.org/java/index.html) on sdk 1.5...
( & tomcat is 5.5....)
thank you..
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: class file has wrong version 50.0, should be 49.0