Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.setProperty method not recognized?

 
Scott Appleton
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Scott Appleton
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7480
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/
...
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic