Running Java on Non-network Local PC

Question:
Can a Java applet or executable run locally on a PC if the PC is not connected to a network? Example: I bring up my home page and download the latest version of my Java app. Somehow that app gets saved locally. When I’m not hooked into the network, can I run the app?

Answer:
In general, the answer is yes, but persistent caching of Java applets may be more difficult to accomplish than you think. In order for a Java applet or application to run locally on your PC, it needs to have all of its class files present locally on the PC’s disk. If that has happened, you can run applets using appletviewer or a Java-enabled browser and execute standalone Java applications using the Java interpreter directly.

The trick, however, is to make sure you have all of the class files cached locally and that you know how to get to them. Browsers typically do cache the Java class files if you enable the cache, such that when you go to your home page and load any applets on there, the browser will download the class files, save a copy in the cache and then run the applet. On subsequent connections, the browser will simply check the time stamp on the class files and if the applet hasn’t changed since it was downloaded, it will use the cached copy.

If you disconnect your PC from the net and try to run the browser again to bring up that page, the browser will not be able to bring up the page or the applet, because it will first attempt to connect to the server to verify that the cached copy is still valid. To work around this limitation, you can try to look into the cache yourself to find the applet’s class files, however, beware that some browsers like Netscape rename the cached files to internally consistent names which are not necessarily human-readable any more.

In most cases, your best bet is to manually download the class files in a place where you can easily manipulate them without worrying about cache consistency issues.

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

Overview

The Latest

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

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