How to execute java program under Linux
If you want to run a java program on ubuntu, you can package the java program after successfully compiling it, and then use the command to execute the jar file on ubuntu
The specific operations are as follows:
1. On windows Use eclipse to compile the java project. After compilation, export it to a runnable jar file
For example, here the test2 file in the test project is exported as the mytest2.jar file
2. Installation of java environment on ubuntu
①jdk official website http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151. html download jdk used on linux
②eclipse official website http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/heliossr1/download linux eclipse used on
③Upload jdk and eclipse to the linux server and decompress it, and then configure the java environment variables (the decompression directory of eg.jdk is /home/test)
Configuration method: edit the /etc/profile file and add the following content (Note: colon in Linux: used to separate paths, dot. indicates the current directory)
export java_home=/home/test /jdk1.8.0_65
export path=$java_home/bin:$path
export classpath=.:$java_home/lib/dt.jar:$java_home/lib/tools.jar
Save the file after editing is completed
④To make the configuration take effect, command source /etc/profile
⑤To test whether the environment variables are configured successfully, command java -version
Display the jdk version, which means the java environment variable is configured successfully
3. Execute the jar file exported by the java project on ubuntu
Command: java -jar mytest2.jar
The above is the detailed content of How to execute java program under Linux. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

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

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

Undress AI Tool
Undress images for free

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)

Hot Topics











The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

Docker is important on Linux because Linux is its native platform that provides rich tools and community support. 1. Install Docker: Use sudoapt-getupdate and sudoapt-getinstalldocker-cedocker-ce-clicotainerd.io. 2. Create and manage containers: Use dockerrun commands, such as dockerrun-d--namemynginx-p80:80nginx. 3. Write Dockerfile: Optimize the image size and use multi-stage construction. 4. Optimization and debugging: Use dockerlogs and dockerex

macOS is suitable for valuing user experience and hardware and software integration, while Linux is suitable for requiring high customizability and flexibility. macOS is simple and easy to use, seamlessly integrated with Apple products; Linux is open source, adapted to various environments, and has rich community resources.

How to generate a Git public key? Simply follow these steps: Open a terminal or command prompt; run the ssh-keygen -t rsa -b 4096 command; select the key saving location; enter a key phrase (optional); verify that the key has been created; copy the public key; add the public key to Git.

Java's platform independence means that the code written can run on any platform with JVM installed without modification. 1) Java source code is compiled into bytecode, 2) Bytecode is interpreted and executed by the JVM, 3) The JVM provides memory management and garbage collection functions to ensure that the program runs on different operating systems.

CentOS is the first choice for server and enterprise environments for its superior security, stability and performance. 1) Security provides forced access control through SELinux to improve system security. 2) Stability is supported by the LTS version for up to 10 years to ensure the stability of the system. 3) Performance significantly improves system response speed and resource utilization by optimizing kernel and system configuration.
