In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "how to execute java programs under Linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to execute java programs under Linux.
If you want to run the java program on ubuntu, you can compile the java program and package it, and then execute the jar file on ubuntu with the command
The specific operations are as follows:
1. Use eclipse to compile the java project on windows, and export it to runnable jar file after compilation
For example, here the test2 file in the test project is export to a mytest2.jar file
2. Install the java environment on ubuntu
① jdk official website http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html downloads jdk for use on linux
② eclipse official website http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/heliossr1/ downloads eclipse for use on linux
③ uploads jdk and eclipse to the linux server and decompresses them, and then configures the java environment variable (the extracted directory for eg.jdk is / home/test)
Configuration method: edit the / etc/profile file and add the following (Note: colon in linux: used to separate paths, periods. Represents 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
④ makes the configuration effective, command source / etc/profile
⑤ tests whether the environment variable is configured successfully, and commands java-version
If the jdk version is displayed, the java environment variable is configured successfully.
3. Jar file exported by java project on ubuntu
Command: java-jar mytest2.jar
At this point, I believe you have a deeper understanding of "how to execute java programs under Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.