Setting the path variable for Java
I had installed
Java
on a Windows 10 system as part of the installation of the
Eclipse
integrated development environment (IDE), which did not add the
directory where the java.exe and javac.exe executable files were installed.
I could temporarily add the directory where Eclipse installed those files
to the path
environment variable—see
Running java from an Eclipse installation from the command line—but
I didn't want to continue to have to do that every time I wanted to compile
a Java program at a command prompt or run one from
a
command-line
interface (CLI). So I added the path to the executable files to the
system-wide path environment variable so it would be permanent and apply
to all accounts on the system.
[ More Info ]
[/languages/java]
permanent link
Setting JAVA_HOME for Gradle
While trying to set up
Gradle, a software develpment build automation tool, on a Microsoft Windows
10 system, when I ran the gradle.bat file in the gradle bin directory, I saw
the message below:
C:\Users\Jim\Downloads\gradle-7.5.1-bin\gradle-7.5.1\bin>gradle.bat
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
C:\Users\Jim\Downloads\gradle-7.5.1-bin\gradle-7.5.1\bin>
I had installed Java with the
Eclipse
integrated development environment (IDE) previously and the java.exe
executable was installed beneath the
C:\Users\Jim\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_18.0.1.v20220515-1614\jre\
directory, so I created a JAVA_HOME
environment
variable pointing to that directory that applied to all accounts on the
system. You can create a temporary JAVA_HOME environment variable for the
account under which you are currently logged in from a
command line
interface (CLI) as noted at
Running java from an Eclipse
installation from the command line, but I wanted to create a permanent
environment variable so I typed advanced system settings
in
the Windows "Type here to search" field and then clicked on View
advanced system settings when I saw that listed.
[ More Info ]
[/languages/java]
permanent link
Excel Proper Case
I inherited an Excel spreadsheet containing names and addresses for all the
members of an organization where all the letters for the names and addresses
were capitalized. I wanted to convert the names and addresses to "proper case"
where only the first letters of names, streets, and cities are capitalized
(in the
Python programming language proper case is known as "title case").
Fortunately, Excel provides a function, propercase, to perform that function.
To perform the conversion, I inserted a new column to the right of each of the
columns where all uppercase letters were used. The first column in the
Excel workbook contained the last names for the members. There was a header
titled "Last Name" in cell A1 with the first person's last name appearing in
cell A2, so in the newly inserted column, B, I put
=proper(A2)
in
cell B2. When I hit
Enter, instead of
AIKIN, JR
in A2, I
then had
Aikin, Jr
in B2. I then clicked in cell B2 and dragged the
mouse pointer downwards to the last row containing a member's contact
information, which resulted in all the members last names being placed in
column B with the proper case, i.e., uppercase letters for the first letter of
the name and lowercase letters for the rest of the name. I couldn't just
delete column A then, which would cause a
#REF!
message to appear
in column B for every name, since I was using a formula that depended on
a value being in column A. So, instead, I copied all of column B by clicking
on the
B
at the top of the column to highlight all entries in
the column. I then used the Ctrl-C keys to copy all of the entries. I then
needed to paste the values in column B into column A, rather than pasting in
the formulas. You can do so, by right-clicking on the column designator
letter, i.e.the
A
for column A in this case, and then choosing
the appropriate paste option, To paste just the values and not the formulas
and formatting, you can click on the icon of a clipboard with "123" on it.
Or you can select Paste Special and then click on the same icon
that appears beneath Paste Values.
Once you've pasted the values that are in proper case, you can delete the
column, e.g., B in this case, where the formulas are used.
Note: for addresses with Post Office boxes, any instance of "PO BOX" would
be replaced with "Po Box," but you can use Excel's find and replace feature
to search for all instances of "Po Box" and have it replace all those
occurences with "PO Box".
[/software/office/excel]
permanent link
PeaZip temporary file location when creating an archive file
I hadn't used PeaZip
as a backup utility previously, but after reading about the program,
I thought it would be well-suited to copy a directory containing about
37 GB of files on a Microsoft
Windows
Small Business Server (SBS) 2003 server to an external
USB drive so
that I could transfer the directory, which was shared over the network
from the server, to the new 2022 server I was setting up to replace
the outdated server. I downloaded the
portable
version, PeaZip
Portable to a USB
flash drive and when I started the program, I specified the
external USB drive as the location for the
.tar archive I
wished to create, but when the PeaZip program showed it was progressing with
the backup, I did not see the archive file on that external drive. After some
time wondering whether PeaZip was actually creating the tar file, I
wondered whether it might be creating a temporary file elsewhere, so
from a command prompt, I checked the location Windows was using to store
temporary files for the account I was using with echo %temp%
and, when I checked that location, found a .tar.tmp file that PeaZip was
using for the ongoing archive process. Unfortunately, that temporary
file was in a directory on drive C that I knew did not have enough free
space left to accomodate the archive file as PeaZip progressed further,
so I had to delete a lot of files from that drive and mover others there
so that I would not have to restart the archive process.
C:\>echo %temp%
C:\DOCUME~1\ADMINI~1.MAY\LOCALS~1\Temp
C:\>cd %temp%
C:\DOCUME~1\ADMINI~1.MAY\LOCALS~1\Temp>dir *.tar.tmp
Volume in drive C has no label.
Volume Serial Number is E88C-7773
Directory of C:\DOCUME~1\ADMINI~1.MAY\LOCALS~1\Temp
08/12/2022 11:14 PM 5,569,092,608 Andy_2022-08-12.tar.tmp
1 File(s) 5,569,092,608 bytes
0 Dir(s) 33,934,786,560 bytes free
C:\DOCUME~1\ADMINI~1.MAY\LOCALS~1\Temp>
When PeaZip concluded the archive process, it moved the
temporary file to the location I specified with the .tmp
extension now removed, but now I know I need to ensure that
the location specified with the Windows %temp%
environment
variable for a site has enough free space to accomodate
the archive file before using PeaZip to create a .zip, .tar,
etc. file archive.
[/software/archiving/PeaZip]
permanent link
Running java from an Eclipse installation from the command line
For an introductory
Java
class I am taking, I installed the
Eclipse
integrated development environment
(IDE)
on a Microsoft Windows 10 system. In addition to compiling and running
Java programs through the IDE, though, I wanted to compile Java programs using
the Java compiler, javac.exe, and run them using java.exe from Windows'
command-line interface (CLI). The installation process for Eclipse
installed the javac.exe and java.exe executables in a user directory with
a long directory path to those executables. Note: you should install the
Eclipse IDE from the account which you wish to use to compile and run
java programs. The location wasn't added to the
path environment
variable, so if you try to run the programs from a command prompt, you will
see the following, unless you specify the full path name where the executable
files are located.
C:\Users\Jim>java
'java' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Jim>javac
'javac' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Jim>
I didn't want to have to copy and paste the full path on the command line
or type it in every time I wanted to use the two executables from the
command line. To avoid that problem you can add the directory path to the
path environment variable through a set path=
command or create
another environment variable, e.g., JAVA_HOME that points to the directory
where the two files are located, though both methods apply only to a particular
command line instance. I.e., if you close a command prompt window where you've
set one of the variables to include the location where Eclipse installed
java.exe and javac.exe then open another command prompt window, you will have
to set the environment variable again in the new instance. An alternative
way to make a permanent path change from a command prompt interface is to use
the Windows setx
command, though I would not recommend it, since if
your path variable already has a path that is more than 1,024 characters long,
setx can truncate the path to 1,024 characters, so that you not only don't
get the additional directory added to the path, but you may lose some of
the path setting you had prior to issuing the command. If you want to
make a permanent change, see responses to the
"Overcoming the 1024 character limit with setx"
posting at the superuser.com site.
[More Info ]
[/languages/java/eclipse]
permanent link