Using Java to Control System Functions

Question:
I would like to be able to browse my server and havean applet/program that would mimic the functions of,say, the control panel on a Macintosh.Would I needto write a custom browser to be able to do this?

Also,I would like to be able to have the server check theversion of the browser and suggest to the user, “Doyou want to update your browser?” If they click”Yes,” have the new browser download and install.

Answer:
Java is probably not the right tool for doing this.

Creatinga control panel like that on the Macintosh requires that yourprogram have intimate knowledge of the operating system andhardware it is running on. Things like the audio volume level,number of colors on the screen, screen saver settings, speed ofthe CPU, battery saving features, and so on, are so tied to theoperating system and the vendor of the hardware, that Java cannotpossibly provide enough hooks for you to be able to accomplishthem all in Java.

Indeed, Java is meant to be used as a cross-platform language thatprovides a uniform, easy to access programming interface to themultitude of environments in use today. The point is thatapplications can be written once and run everywhere equally well.Putting in platform-specific dependencies takes away much of theadvantages of programming in Java in the first place.Moreover, Java applets are restricted even further in what they cando. This feature is what makes Java a secure programming languagefor the Web. An applet would never be allowed to read or configurea system’s settings, for example, because these could be exploitedby malicious applets.

The only system settings an applet would be able to read are thoseaccessible via the System.getProperties() call. This methodtakes astring parameter describing the property in question.Properties are divided into two categories: hidden and non-hiddenones. Hidden ones cannot be read by applets by default.

The list is as follows:

Non-hidden Properties  Description——————————————————-java.version           Java version numberjava.vendor            Java-vendor-specific stringjava.vendor.url        Java vendor URLjava.class.path        Java classpathos.name                Operating system nameos.arch                Operating system architectureos.version             Operating system versionfile.separator                 File separator (“/” on Unix)path.separator                 Path separator (“:” on Unix)line.separator                 Line separator (”
” on Unix)Hidden Properties Description——————————————————-user.name User account nameuser.home User home directoryuser.dir User’s current working directoryjava.home Java installation directoryjava.class.version Java class format version number
As you can see, this list is much too limited to allow youto do sophisticated things, but one thing you’ll notice isthat an applet can get the version of the operating systemand the browser if that information is carried in thejava.vendor property. The applet can then notify theuser that his/her browser is out of date and suggest thathe/she download a newer version.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may

man on floor with data

DevX Quick Guide to Data Ingestion

One of the biggest trends of the 21st century is the massive surge in internet usage. With major innovations such as smart technology, social media, and online shopping sites, the internet has become an essential part of everyday life for a large portion of the population. Due to this internet

payment via phone

7 Ways Technology Has Changed Traditional Payments

In today’s digital world, technology has changed how we make payments. From contactless cards to mobile wallets, it’s now easier to pay for goods and services without carrying cash or using a checkbook. This article will look at seven of the most significant ways technology has transformed traditional payment methods.