aspose file tools*
The moose likes Beginning Java and the fly likes System.setProperty method not recognized? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "System.setProperty method not recognized?" Watch "System.setProperty method not recognized?" New topic
Author

System.setProperty method not recognized?

Scott Appleton
Ranch Hand

Joined: May 07, 2001
Posts: 195
The following line of code:
code:

System.setProperty ("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.ssl.protocol");
generates the following error:
"Method setProperty(java.lang.String, java.lang.String) not found in class java.lang.System"
How could this error ever be generated, since of course there is such a method in
java.lang.System.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
You didn't give a valid key in the first position. These are the valid keys.

Key = Description of Associated Value

java.version = Java Runtime Environment version
java.vendor = Java Runtime Environment vendor
java.vendor.url = Java vendor URL
java.home = Java installation directory
java.vm.specification.version= Java Virtual Machine specification version
java.vm.specification.vendor =Java Virtual Machine specification vendor
java.vm.specification.name =Java Virtual Machine specification name
java.vm.version =Java Virtual Machine implementation version
java.vm.vendor =Java Virtual Machine implementation vendor
java.vm.name =Java Virtual Machine implementation name
java.specification.version =Java Runtime Environment specification version
java.specification.vendor =Java Runtime Environment specification vendor
java.specification.name =Java Runtime Environment specification name
java.class.version =Java class format version number
java.class.path =Java class path
java.ext.dirs =Path of extension directory or directories
os.name =Operating system name
os.arch =Operating system architecture
os.version =Operating system version
file.separator =File separator ("/" on UNIX)
path.separator =Path separator (":" on UNIX)
line.separator =Line separator ("\n" on UNIX)
user.name =User's account name
user.home =User's home directory
user.dir =User's current working directory

[This message has been edited by Cindy Glass (edited July 24, 2001).]


"JavaRanch, where the deer and the Certified play" - David O'Meara
Scott Appleton
Ranch Hand

Joined: May 07, 2001
Posts: 195
Cindy, maybe this is a new property. The JSSE Extension installation indicates that in order to use the https protocol, you must set the "java.protocol.handler.pkgs" system property, either at the command line (which is not possible in the implementation I'm having to use) or via a call to System.setProperty().
I'm also getting a "security properties not found. using defaults" message when I compile. My java.security file is located in a standard location (<java-home>\lib\security)
[This message has been edited by Scott Appleton (edited July 24, 2001).]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

This seems to work:

Partial output:
System.properties:
java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition
java.protocol.handler.pkgs=com.sun.net.ssl.internal.ssl.protocol
sun.boot.library.path=d:\java2\jre\bin
java.vm.version=1.3.1-b24
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
...

Junilu - [How to Ask Questions] [How to Answer Questions]
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Well, if that works then Scott must have either misspelled the setProperty method name, or perhaps he has a stray version of a class called System that does not have this method or . . .

At any rate I was poking around looking at stuff related to this and I found an article that shows how to use URLStreamHandlerFactory as an alternative.

An alternative to using the XYZ.protocol.Handler package and class naming convention (along with the java.protocol.handler.pkgs system property) previously described is implementing your own URLStreamHandlerFactory. The default URLStreamHandlerFactory pays attention to the java.protocol.handler.pkgs system property and applies the package and class naming conventions. Your alternative implementation of the URLStreamHandlerFactory interface could get a handler implementation from wherever it wanted.

From about the middle of: http://developer.java.sun.com/developer/onlineTraining/protocolhandlers/
Scott Appleton
Ranch Hand

Joined: May 07, 2001
Posts: 195
Thanks, Cindy. I'm going to explore this link and see what can be done.
I have a partial answer to the original problem -- the IDE I'm using (which I HAVE to use, ugh) implements JDK 1.1.8. Turns out that setProperty(String, String) is new to the System class in 1.2, so the compiler used by the IDE doesn't recognize it.
That doesn't explain the "security properties not found. using defaults" message when I compile using my own version of the JDK (v1.3).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: System.setProperty method not recognized?