android studio run java code

Please indicate the source for reprinting: http://renyuan-1991.iteye.com/blog/2306406
Sometimes we need to test whether the logic code can run normally. At this time, we need to run the java code in android studio.
Step 1:
    Right click file, select new module, and select java Library as shown in the figure below.



Step 2:
    Name the new module:



    Then you can see the new module as shown in the figure below:



Step 3:
    Click Run Configuration on the toolbar:



      Enter the following interface:



      Then click the The "+" on the interface selects Application, as follows:



Step 4:
     Configure Main Class, Working directory and use class path of module. As shown below:
    First select Working directory:



    Then select module:



    Finally select Main Class:
    Click behind "Main Class" After entering the following interface, select the class we use for testing as shown in the figure below.



     For the first time, the test class may not be found in a short time. Select "project" directly to find the path of our test class, and then select class file.



    Then we can give this test item an easily distinguishable name, as follows:



Step 5:
    Select our test project and click the green triangle to run. You can



   also right-click on the class name or method name and click to run, but all running is an Application, as follows:



Please indicate the source for reprint: http://renyuan-1991.iteye. com/blog/2306406
I hope that programming-loving friends can join this group, help each other, and learn together. Group number: 141877583

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326782808&siteId=291194637