How to set up java?
After the installation is completed according to the system classification of 32-bit or 64-bit,
You need to set the environment variables. Specifically, right-click "My Computer (Computer)"-"Properties"- - "Advanced System Settings" - "Advanced" - "Environment Variables"
Set the three system variables JAVA_HOME PATH CLASSPATH. If not, just add them.
JAVA_HOME points to the JDK Installation path, such as C:\jdk1.5.0_06, you should be able to find bin, lib and other directories in this path.
( I am using the new system configuration tonight. I don’t know why I need to add bin to run it in CMD. JAVA_HOME=C:\jdk1.5.0_06\bin; The following is the online practice that can be used and posted. Note that JDK and Eclipse must have the same bit number before they can be used. They cannot be programs with different bit numbers. This has been practiced, otherwise an error will be reported and cannot be used. If you need to uninstall the JDK, the JDK cannot directly delete the folder. You must use the uninstall method, otherwise it cannot be used anymore. The JDK may not be uninstallable. You can only use it by reinstalling the OS. I have encountered it before)
JAVA_HOME=C:\jdk1.5.0_06
PATH environment variable originally exists in Windows. You only need to modify it so that it points to the bin directory of the JDK, so that you can There is no need to type in a long list of paths when compiling and executing the program under the console. The setting method is to retain the original PATH content and add %JAVA_HOME%\bin
(Note, if you don’t understand DOS batch processing, you may not understand what the content caused by %% is. Meaning; in fact, here is a reference to the environment variable JAVA_HOME set in the previous step. You can also write it as x:\JDK_1.4.2; you can open a console window and enter echo %JAVA_HOME% to see your setting results)
PATH=%JAVA_HOME%\bin;%PATH%
Similarly, %PATH% refers to the PATH environment variable you set before. You can just copy the previous value.
I put the CLASSPATH environment variable at the end because more than 80% of the inexplicable strange problems you have in the future may be caused by incorrect CLASSPATH settings, so be extra careful.
CLASSPATH=.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
The first thing to pay attention to is the ".;" at the front. If you can't see clearly, I'll read it to you - period semicolon. This tells the JDK to first search for the CLASS file in the current directory when searching for CLASS - why this is done? This is due to the security mechanism of LINUX. LINUX users understand it very well, but WINDOWS users have a hard time understanding it (because the default search order of WINDOWS is Search the current directory first, then search the system directory, and then search the PATH environment variable setting).
Why is the specific file tools.jar specified after CLASSPATH? Is it okay not to specify? Obviously not, if it works I can still be so rosy! :) This is determined by the import mechanism and jar mechanism of the Java language. You can check the information to solve it.
Recommended tutorial: "java learning"
The above is the detailed content of How to set up java. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

To correctly handle JDBC transactions, you must first turn off the automatic commit mode, then perform multiple operations, and finally commit or rollback according to the results; 1. Call conn.setAutoCommit(false) to start the transaction; 2. Execute multiple SQL operations, such as INSERT and UPDATE; 3. Call conn.commit() if all operations are successful, and call conn.rollback() if an exception occurs to ensure data consistency; at the same time, try-with-resources should be used to manage resources, properly handle exceptions and close connections to avoid connection leakage; in addition, it is recommended to use connection pools and set save points to achieve partial rollback, and keep transactions as short as possible to improve performance.

TheJVMenablesJava’s"writeonce,runanywhere"capabilitybyexecutingbytecodethroughfourmaincomponents:1.TheClassLoaderSubsystemloads,links,andinitializes.classfilesusingbootstrap,extension,andapplicationclassloaders,ensuringsecureandlazyclassloa

Use classes in the java.time package to replace the old Date and Calendar classes; 2. Get the current date and time through LocalDate, LocalDateTime and LocalTime; 3. Create a specific date and time using the of() method; 4. Use the plus/minus method to immutably increase and decrease the time; 5. Use ZonedDateTime and ZoneId to process the time zone; 6. Format and parse date strings through DateTimeFormatter; 7. Use Instant to be compatible with the old date types when necessary; date processing in modern Java should give priority to using java.timeAPI, which provides clear, immutable and linear

Pre-formanceTartuptimeMoryusage, Quarkusandmicronautleadduetocompile-Timeprocessingandgraalvsupport, Withquarkusoftenperforminglightbetterine ServerLess scenarios.2.Thyvelopecosyste,

Java's garbage collection (GC) is a mechanism that automatically manages memory, which reduces the risk of memory leakage by reclaiming unreachable objects. 1.GC judges the accessibility of the object from the root object (such as stack variables, active threads, static fields, etc.), and unreachable objects are marked as garbage. 2. Based on the mark-clearing algorithm, mark all reachable objects and clear unmarked objects. 3. Adopt a generational collection strategy: the new generation (Eden, S0, S1) frequently executes MinorGC; the elderly performs less but takes longer to perform MajorGC; Metaspace stores class metadata. 4. JVM provides a variety of GC devices: SerialGC is suitable for small applications; ParallelGC improves throughput; CMS reduces

Networkportsandfirewallsworktogethertoenablecommunicationwhileensuringsecurity.1.Networkportsarevirtualendpointsnumbered0–65535,withwell-knownportslike80(HTTP),443(HTTPS),22(SSH),and25(SMTP)identifyingspecificservices.2.PortsoperateoverTCP(reliable,c

defer is used to perform specified operations before the function returns, such as cleaning resources; parameters are evaluated immediately when defer, and the functions are executed in the order of last-in-first-out (LIFO); 1. Multiple defers are executed in reverse order of declarations; 2. Commonly used for secure cleaning such as file closing; 3. The named return value can be modified; 4. It will be executed even if panic occurs, suitable for recovery; 5. Avoid abuse of defer in loops to prevent resource leakage; correct use can improve code security and readability.

Gradleisthebetterchoiceformostnewprojectsduetoitssuperiorflexibility,performance,andmoderntoolingsupport.1.Gradle’sGroovy/KotlinDSLismoreconciseandexpressivethanMaven’sverboseXML.2.GradleoutperformsMaveninbuildspeedwithincrementalcompilation,buildcac
