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 / May 2006

Tip: Looking for answers? Try searching our database.

How to specify URLStreamHandlerFactory  in jdk command line?

Thread view: 
jacksuyu@gmail.com - 24 May 2006 18:23 GMT
I have a special URLStreamHandlerFactory  and want to set to an
existing jdk application.

How to do it without change java code?

Thank you.
Oliver Wong - 24 May 2006 18:47 GMT
>I have a special URLStreamHandlerFactory  and want to set to an
> existing jdk application.
>
> How to do it without change java code?

   Given that URLStreamHandlerFactory is an interface and thus contains no
behavioural code, this sounds like a really bad idea.

   But if you really wanted to do this, I suppose you could go into your
JRE directory and mess around with the JAR/ZIP files to replace th existing
stuff there with your new class file.

   - Oliver
Thomas Hawtin - 24 May 2006 18:50 GMT
> I have a special URLStreamHandlerFactory  and want to set to an
> existing jdk application.
>
> How to do it without change java code?

The two obvious choices are:

Use a Java Agent to call URL.setURLStreamHandlerFactory, but not
actually do any instrumentation. I've got an example of doing something
similar with EventQueue.push.

http://jroller.com/page/tackline?entry=detecting_invokeandwait_abuse

The alternative is to set -Djava.protocol.handler.pkgs=mypackage, then
instead of using URLStreamHandlerFactory provide URLStreamHandler
classes with no-arg constructors and names of the form
mypackage.protocol.Handler. See the source code to URL...

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/



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.