Read about how to run java program in eclipse step by step, The latest news, videos, and discussion topics about how to run java program in eclipse step by step from alibabacloud.com
installation path is: C:\Program Files (x86) \arcgisFirst of all, configure the Arcobject environment in the IDE:Select MyEclipse Menu Windows-Preferences, choose Tomcat on the left servers, configure the appropriate Tomcat paths environment, as follows:In the second case, configure the Tomcat runtime environment:Follow Tomcat's Java environment Configuration instructions, create a new SetEnv.bat script fi
The first is calculated in milliseconds.Java codePseudo codeLong Starttime=system.currenttimemillis (); Get Start timeDoSomething (); Code snippet for testingLong Endtime=system.currenttimemillis (); Get End timeSYSTEM.OUT.PRINTLN ("program Run Time:" + (End-start) + "MS");Pseudo codeLong Starttime=system.currenttimemillis (); Get Start timeDoSomething (); Code snippet for testingLong Endtime=system.current
Developing a Java application typically consists of three steps :1. Create a source file with the file name extension *.java1). Using the editor (such as Notepad, the notepad++ is used), enter the following 6 lines of text:1 // A simple application example: print a line of text 2 class Hello {3 Public Static void Main (String args[]) {4 System.out.println ("Hello java,this is my first
After downloading the JDK, set the environment variables first. WIN10 Setting the environment is a little different from the way it was before, write it down here.1. In the system environment variables, divided into user variables and system variables, where the operation is in the system variable2. Click "New", the variable is named "Java_home", the variable value is the address of the JDK, I am here for
C:\Program files\
/bin/hadoop Fs-cat./OUT/PART-XXX (successfully running a mapreduce job) Note:(If error: Org.apache.hadoop.mapred.SafeModeException:JobTracker is in safe mode, turn off safety)Hadoop Dfsadmin-safemode LeaveHadoop2.8.1 Lab Environment Operation Sample algorithm Note:It looks like a mapreduce sample, such as a Hadoop jar./share/hadoop/mapreduce/hadoop-mapreduce-Examples-2.8.1.jar Pi 5 5) before you can use the Hadoop fs-xxx command, such as-ls,-put ...The Hadoop fs root directory is/user/henry(If
Note SpaceThis article mainly describes the method of calling Java in the bat batch file under window.@echo offECHO is encrypting, please later ....Echo path:%~dp0Set Base=%~dp0Set Class=%base%\binSet Libs=%base%\libSet Class_path=%class%;%libs%\c3p0-0.9.1.2.jar;%libs%\mysql-connector-java-5.0.8-bin.jar;Java-classpath%class_path% Com.test.Main@pauseFile structure
1 Public classtesttmp {2 Public Static voidMain (string[] args) {3 //TODO auto-generated Method Stub4 for(inti=0;i){5System.out.println (i+ "=" +args[i]);6 }7 }8 } 9 Ten Public classtesttmp { One Public Static voidMain (string[] args) { A //TODO auto-generated Method Stub - for(inti=0;i){ -System.out.println (i+ "=" +Args[i]); the } - } -}Note: The class is created under the default package path;
is:manifest-version:1.0Created-by:1.8. 0_60 (Oracle Corporation) Main-class: Org.lz.demo.b.importdemoThen use this manifest file to regenerate the jar package, copy the modified MANIFEST.MF, and the org in the same directory, and then regenerate the jar package using the following command:Jar CFM Lz.jar MANIFEST. MF org ( jar cfm [jar file name] [additional manifest file name] [import file])Then, execute:Java-jar Lz.jar;The program runs successfully.
After we have written our "Helloworld.java" and built the Java development environment, we can run the Java program.Specifically how to implement, let's take a look at:
Turn on DOS
Go to the "Helloworld.java" folder through the DOS command and enter "Javac Helloworld.java" in the DOS window, such as:
After compiling, in the original folder will produce
An error occurred when I tried to run window's cmd command through Processbuilder in Java:
public static void main(String [] args) throws IOException {
ProcessBuilder builder = new ProcessBuilder();
Process process = builder.command("dir d:\\").start();
InputStream inputStream = process.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream,"gb2312")
Package cn.imeixi.chapter1.exer; Public class Exer10printargs { publicstaticvoid main (string[] args) { for (int i = 0;i ) { System.out.println ("args[" + i + "] =" + args[i]);
} }} First exer10printargs . Java to be placed in a subfolder. For example exer10printargs . Java declaration belongs to package Cn.imeixi.chapter1.exer; So you're going to put e
Long startTime = System.currenttimemillis (); Get Start timeDoSomething (); Code snippet for testingLong endTime = System.currenttimemillis (); Get End timeSYSTEM.OUT.PRINTLN ("program Run Time:" + (Endtime-starttime) + "MS"); Output program run timeThe second is measured in nanoseconds.Long Starttime=system.nanotime (
The
code is as follows:
The first is calculated in milliseconds.
longstarttime=system.currenttimemillis (); //Get start time
dosomething (); //test code snippet
Long endtime=system.currenttimemillis (); //get end time
System.out.println ("program Run Time:" + (endtime-starttime) + "MS"); //Output program
Java version is 1.6.0_26, run the program when the log print time and the system time difference of 8 hours, the system's time zone is/etc/sysconfig/clock for zone= "Asia/shanghai", is no problem, So what is the solution to this problem?cd/usr/jdk1.6.0_26/jre/lib/zi/MV GMT Gmt_bakCP./etc/gmt-8 GMTRerun the program and
Summary of Java issues 14-Program run time measurementCode:Package Java2;public class Test6 {public static void main (string[] args) {long start=system.currenttimemillis (); for (int i =1;iResults:...//omit n 9999899999100000time is 2.583sCopyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.Summary of
The program timing function is not very useful, but when writing the sorting algorithm with the program timing function can be very intuitive to feel the time of the different sorting algorithm. (assuming, of course, that the amount of data involved is large enough)There are two ways to get time in Java:1. Use the Calendar class (package as Java.util.Calendar) to
There are three main types of program running in Java:1, sequential structure: Sequential structure is the execution of each line of code sequentially2, branching structure: branch structure is branching according to different conditions3, loop structure: A piece of code is executed according to the conditions of the loop.Of these, there are two main types of branching structures:If...else ... Structure and
1. JavaMain functionpublic static void Main (String [] args) {}it's inside.Argsis what. This is the initial parameter when the program starts. You can pass in at startup. such as:Java MyClass ABC 123At thisArgs[0] = = "ABC" args[1] = = "123"2. javaTest Code Package order;public class Testmain {public static void Main (string[] args) {for (String Temp:args) {SYSTEM.OUT.PRINTLN (temp);}}}Note:because The Testmain class is placed under the package order
A way to run a Java program on a regular basis
Used to be the thread of the sleep method, always feel inappropriate, and now found the solution, has not been measured, think should be appropriate:
Javax.swing.Timer TM = new Javax.swing.Timer (1000, new ActionListener () {//1000 is 1 secondpublic void actionperformed (ActionEvent e) {Do something here}});Tm.star
get the number of times an application runs, if more than 5 times, give the number of times the usage has been registered, and do not run the program againImport Java.io.file;import java.io.fileinputstream;import java.io.fileoutputstream;import java.io.IOException; Import Java.util.properties;public class Test5 {public static void main (string[] args) throws Exception {Getappcount ();} private static void G
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.