The Artima Developer Community
Sponsored Link

Java Answers Forum
i need help...

5 replies on 1 page. Most recent reply: Jun 14, 2003 12:49 AM by psmore73

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
abdel

Posts: 11
Nickname: caram
Registered: May, 2003

i need help... Posted: Jun 13, 2003 3:46 AM
Reply to this message Reply
Advertisement
hi all,
I try to run this program it gives the following error:

java.lang.NumberFormatException: Fpr input string: "jav"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Float.parserFloat(Unknown Source)
at swing.myApplet.compareValue(myApplet:48)

String value = System.getProperty( propertyName );
if(propertyName.equals("java.version"))

zeile 48: if((float)(Float.parseFloat(((propertyName)).substring(0, 3))*10) >
12)
{
return true;
}
else
{
System.out.println("Your Java Version must be 1.2 or later!");
}

can anyone tell me what' wrong??
Thanks in advance


al

Posts: 11
Nickname: allelopath
Registered: Jun, 2003

Re: i need help... Posted: Jun 13, 2003 6:12 AM
Reply to this message Reply
This is just a guess since i don't know what propertyValue contains. I would guess its something like "java 1.2"
the substring you are extracting is (0,3) which would "java" or possibly "java" instead of what you should be trying to extract (the "1.2")...I would try changing the indices of your substring.

al

Posts: 11
Nickname: allelopath
Registered: Jun, 2003

Re: i need help... Posted: Jun 13, 2003 6:12 AM
Reply to this message Reply
oops, sorry, propertyName, not propertyValue

abdel

Posts: 11
Nickname: caram
Registered: May, 2003

Re: i need help... Posted: Jun 13, 2003 6:56 AM
Reply to this message Reply
propertyName contains "java.version"
propertyValue contains "1.2"

i want that my applet will be started just when the client has installed "java.version 1.2" or later

Regards

Paul Wujek

Posts: 7
Nickname: pw
Registered: May, 2003

Re: i need help... Posted: Jun 13, 2003 7:29 AM
Reply to this message Reply
> if((float)(Float.parseFloat(((propertyName)).substring(0,3))*10) > 12)

You are converting the first 3 characters of the string "java 1.2" to a float.

You want to convert the substring preceded by the last space to a float for this logic to work.

to do this use

propertyValue.substring(propertyValue.lastIndexOf(' '))

as the source string for the conversion

psmore73

Posts: 4
Nickname: psmore73
Registered: Jun, 2003

Re: i need help... Posted: Jun 14, 2003 12:49 AM
Reply to this message Reply
You are Trying to parse propertyName which contains String "java.version" try to parse value which contains "1.2.0" or any java version

Flat View: This topic has 5 replies on 1 page
Topic: i need help... Previous Topic   Next Topic Topic: convert .xls file to .csv

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use