Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

System.setProperty and java.lang.noSuchMethodError (!)

Thread view: 
Marco - 04 Jan 2006 07:21 GMT
The method System.setProperty("name", "value"), if user haven't SUN
java, give at runtime the error "java.lang.noSuchMethodError:
java/util/Properties: Method
setProperty(Ljava/lang/String;Ljava/lang/String)Ljava/lang/Object; not
found".

There is an alternative of System.setProperty compatible with Microsoft
java?
Andrew Thompson - 04 Jan 2006 08:02 GMT
...
> There is an alternative of System.setProperty compatible with Microsoft
> java?

You are doing end users a disservice by supporting this
obsolete and insecure JVM.  Encouraging the ever shrinking
pool of IE/MSVM users to upgrade to the Sun Java plug-in
(or Mozilla/Opera..) would be a better course of action.

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew

Roedy Green - 04 Jan 2006 15:01 GMT
On Wed, 04 Jan 2006 08:02:02 GMT, Andrew Thompson
<seemysites@www.invalid> wrote, quoted or indirectly quoted someone
who said :

>You are doing end users a disservice by supporting this
>obsolete and insecure JVM.  Encouraging the ever shrinking
>pool of IE/MSVM users to upgrade to the Sun Java plug-in
>(or Mozilla/Opera..) would be a better course of action.

It is over 10 years old. Could you imagine using a Netscape from that
same vintage?
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Chris Smith - 04 Jan 2006 08:04 GMT
> The method System.setProperty("name", "value"), if user haven't SUN
> java, give at runtime the error "java.lang.noSuchMethodError:
> java/util/Properties: Method
> setProperty(Ljava/lang/String;Ljava/lang/String)Ljava/lang/Object; not
> found".

Look up setProperty in the API docs.  See the little bit where it says
"Since:" and "1.2".  That's your cue that the method is not available in
Java 1.1 and earlier, which include Microsoft's JVM.

> There is an alternative of System.setProperty compatible with Microsoft
> java?

Yes, there is.  It's System.getProperties, followed by setProperty on
the resulting Properties object.  However, you can't do it in an
unsigned applet or without asking for appropriate permissions.

Incidentally, it's irresponsible to ask people to install the Microsoft
JVM.  Microsoft is no longer distributing security updates to that
product, and it constitutes a potential risk of virii and other
nastiness.  I'd strongly encourage you to abandon that nonsense, and
either implement what you're working on in a more modern version of
Java, or if you can't do that then go for Flash or JavaScript instead.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Marco - 04 Jan 2006 09:15 GMT
>> There is an alternative of System.setProperty compatible with Microsoft
>> java?
>
> Yes, there is.  It's System.getProperties, followed by setProperty on
> the resulting Properties object.

How can I set Properties object, if I can't use
java.util.Properties.setProperty(String,String)?

> However, you can't do it in an
> unsigned applet or without asking for appropriate permissions.

No problem, I need to do a signed applet.

> Incidentally, it's irresponsible to ask people to install the Microsoft
> JVM.

No, no, I don't need Microsoft JVM, my hope is that user have SUN JVM, but I
write a web applet, and I know many people that have only Microsoft JVM
installed, and I want compatibly with ALL JVM. I think that not all user of
my applet can be able (or they not want) install SUN JVM.
Andrew Thompson - 04 Jan 2006 10:41 GMT
...
> No, no, I don't need Microsoft JVM, my hope is that user have SUN JVM, but I
> write a web applet, and I know many people that have only Microsoft JVM
> installed, and I want compatibly with ALL JVM.

How do you account for 'no java'?
Forget IE for the moment - some browsers will have NO VM at all
(including some release of IE, but I thought I should stress
that it might hit almost any browser - most browser makers
offer 'Java/No Java' versions).

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew

Marco - 04 Jan 2006 11:26 GMT
>> No, no, I don't need Microsoft JVM, my hope is that user have SUN JVM,
>> but I write a web applet, and I know many people that have only Microsoft
[quoted text clipped - 5 lines]
> that it might hit almost any browser - most browser makers
> offer 'Java/No Java' versions).

I want studying java web start... but if applet too work, it is better. But
I need an equivalent of System.setProperty that work with Java Sun and with
Java Microsoft too...

There isn't a solution?
Andrew Thompson - 04 Jan 2006 11:46 GMT
>>>No, no, I don't need Microsoft JVM, ..
..
> I want studying java web start...

It is a good option generally, though slighlty less so for applets.
Compare these two examples ..
<http://www.physci.org/pc/jtest.jnlp>
<http://www.physci.org/pc/jtest-applet.jnlp>

Note that the Java Plug-In (Java 1.3+, AFAIR) supports
Java Web Start.  An IE with the MSVM or a browser with
no VM might need to determines the correct application
by 'using the web service'.

>..but if applet too work, it is better. But
> I need an equivalent of System.setProperty that work with Java Sun and with
> Java Microsoft too...
>
> There isn't a solution?

What system property/s do you need to change, and why?

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew

Marco - 04 Jan 2006 12:25 GMT
>> I want studying java web start...
>
> It is a good option generally, though slighlty less so for applets.
My jar work well as application, but as applet I have some problem to set
the equivalent of
"-Djavax.net.ssl.trustStore=pwd -Djavax.net.ssl.trustStorePassword=123456".
An application (non applet) is good for me, only I need automatic
installation of java plugin, if the user need it.

> What system property/s do you need to change, and why?

As I said, some as the following:

   System.setProperty("javax.net.ssl.trustStore", "C:\\prcorso\\pwd.jks");
   //not very good for compatibility, but now this isn't the question. This
must work in all JVM of browsers (IE, above all).
   System.setProperty("javax.net.ssl.trustStorePassword", "123456");

The applet must send username, password and some elements that the user
inserted with an encripted (SSL) connection with the website of the applet,
and receive an eleboration with SSL.

If I compile my applet with 1.2 or 1.3, I use the library
jsse-1_0_3_03-gl.zip. If I compile with 1.4 or 1.5, the library for SSL is
not necessary.

Client and server are build as in the page
http://tvilda.stilius.net/java/java_ssl.php
Marco - 04 Jan 2006 13:37 GMT
>>> There is an alternative of System.setProperty compatible with Microsoft
>>> java?

It is possible to find source code of SUN Property class, and insert it as a
library for jar file?
Roedy Green - 04 Jan 2006 15:03 GMT
>It is possible to find source code of SUN Property class, and insert it as a
>library for jar file?

There must be some mistake.  System properties are initialised by a
native method which makes it hard to fake. How could Java function
without system properties?
Surely even the MS JVM has them. See
http://mindprod.com/jgloss/properties.html
for sample code.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Marco - 04 Jan 2006 16:18 GMT
>>>> There is an alternative of System.setProperty compatible with Microsoft
>>>> java?
>
> It is possible to find source code of SUN Property class, and insert it as
> a library for jar file?

I rewrite the following class:

// source of msft/Proprieta.java
//**********************

package msft;

import java.util.Hashtable;
import java.util.Properties;

public class Proprieta extends Properties
{
 public synchronized Object setProperty(String s, String s1)
  {return put(s, s1);}

//constructors
 public Proprieta()
  {super(null);}
 public Proprieta(Properties properties)
  {super(properties);}
}

//**********************

This work, if I use, in the init of main class:

//**********************
try
{
 msft.Proprieta p=new msft.Proprieta(System.getProperties());
 p.setProperty("javax.net.ssl.trustStore",
"D:\\Siti\\equazioni\\java\\jar\\pwd.jks");
 p.setProperty("javax.net.ssl.keyStore",
"D:\\Siti\\equazioni\\java\\jar\\pwd.jks");
 p.setProperty("javax.net.ssl.keyStorePassword", "123456");
 p.setProperty("javax.net.ssl.trustStorePassword", "123456");
 System.setProperties((java.util.Properties)p);
}
catch (Exception e)
{System.out.println("errore: "+e);}
//**********************

N.B. I haven't tested it with signed applet, because I still need understand
Microsoft procedure, but if i use "msft.Proprieta p=new msft.Proprieta();"
for avoid  com.ms.security.SecurityExceptionEx in System.getProprieties(),
p.setProperty work as espected.
Roedy Green - 04 Jan 2006 17:33 GMT
>N.B. I haven't tested it with signed applet, because I still need understand
>Microsoft procedure, but if i use "msft.Proprieta p=new msft.Proprieta();"
>for avoid  com.ms.security.SecurityExceptionEx in System.getProprieties(),
>p.setProperty work as espected.

That's your problem. See http://mindprod.com/jgloss/properties.html
there are safe and restricted proprieties. You can't get hold of the
entire set of properties is an unsigned applet.  You are not going to
sign it for MS. You can't even buy the old certs anymore.

see also http://mindprod.com/applets/wassup.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.