File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "System.setProperty method not recognized?" Watch "System.setProperty method not recognized?" New topic

System.setProperty method not recognized?

Scott Appleton
Ranch Hand

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

System.setProperty ("java.protocol.handler.pkgs", "");
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
Cindy Glass
"The Hood"

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 Virtual Machine specification name
java.vm.version =Java Virtual Machine implementation version
java.vm.vendor =Java Virtual Machine implementation vendor =Java Virtual Machine implementation name
java.specification.version =Java Runtime Environment specification version
java.specification.vendor =Java Runtime Environment specification vendor =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 =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'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 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

Joined: Feb 26, 2001
Posts: 6529

This seems to work:

Partial output: 2 Runtime Environment, Standard Edition
java.vm.vendor=Sun Microsystems Inc.

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

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:
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).
I agree. Here's the link:
subject: System.setProperty method not recognized?
It's not a secret anymore!