• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Change of System class

 
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried to change a system class and I also want that changes to be reflected in my program Actuall What I have done is as we all know that java/jre/lib/rt.jar contains the actual system class for acccess. Now I want to change the System.java file that whenever we want to exit by calling System.exit() method There should be a statement about the author. I know this is not at all important but this will help in those projects which want to change some algorithms and then prescribed to SUN to change them. Thats why I am asking this question::: I am also enclosing the function which I want to change in System.java Class(In java.lang package).Please do help me because I want to further change the algorithm in Classes which implements List Interface.
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, first, don't do this. Why not use Runtime.addShutdownHook() instead? This is the proper way to schedule code to run when the VM is shut down.

Second, if you really need to replace a system class, you just have to put that class on the "bootclasspath" using the -Xbootclasspath/p: switch. But as I said, don't do it.
 
Shaan Shar
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you please tell me the procedure for doing this as u advised for bootpathclass
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
-Xbootclasspath/p: is a command-line switch to the java.exe program. The argument it takes is the same as -classpath uses. Use "java -X" to get a little bit of help for this option.

But as I said: don't do it for this reason, it's silly. Just use a shutdown hook. Why make your program nonportable and dependent on being launched with certain options, when you can just use a small amount of legal, portable Java code?
 
No thanks. We have all the government we need. This tiny ad would like you to leave now:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic