In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
After IntelliJ has installed the Scala plug-in, you need to try to use IntelliJ to create and run the first program.
Usually this program simply outputs Hello World.
Create a new project
Select New under the file, and then select create Project.
Enter project information
Above creating the project, enter the information of the project, specify the path of the project, and so on.
What you need to pay special attention to here is to create the Scala SDK configuration of the project. You need to configure SDK in your system now. For ways to configure SDK, please refer to the contents of Scala installation and environment configuration on the page.
Select SDK
After clicking create, you will see the SDK you need to select.
Just select the SDK you need here.
Complete the new project interface after SDK selection
When you have finished selecting the SDK project, you can see that your SDK has been configured as shown in the figure below.
Then click Finish in this interface and you can finish creating the project.
Create your first Scala program
In the newly created project, use the mouse to navigate to the src folder, then right-click to create a new class for Scala.
Enter the name of the new class
In the pop-up window, enter the name of the class you want to create.
Here, we assume that the name of the class you want to create is Hello, where you can enter the name of your newly created class, Hello.
Enter code
You can simply enter the following code in the code input window:
Object Hello extends App {println ("Hello, World!")}
The above code will simply enter the string Hello, World!
Run the code
You have the following two methods to run the code, and you can select the class you want to run in the project on the left. Then right-click and select run Hello,Hello in the pop-up window. This is the name of the class you created.
You can also click to run the class you created directly on your program.
The results of running the program can be seen in the console below.
In this way, you have finished creating and running your first Scala class.
"C:\ Program Files\ Java\ jdk1.8.0_172\ bin\ java.exe"-javaagent:C:\ Program Files\ JetBrains\ IntelliJ IDEA Community Edition 2018.3.3\ lib\ idea_rt.jar=58176:C:\ Program Files\ JetBrains\ IntelliJ IDEA Community Edition 2018.3.3\ bin "- Dfile.encoding=UTF-8-classpath" C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ charsets.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ deploy.jar C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ access-bridge-64.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ cldrdata.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ dnsns.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ jaccess.jar C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ jfxrt.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ localedata.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ nashorn.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ sunec.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ sunjce_provider.jar C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ sunmscapi.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ sunpkcs11.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ ext\ zipfs.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ javaws.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ jce.jar C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ jfr.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ jfxswt.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ jsse.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ management-agent.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ plugin.jar C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ resources.jar;C:\ Program Files\ Java\ jdk1.8.0_172\ jre\ lib\ rt.jar;C:\ Users\ Yucheng\ Documents\ WorkDir\ Repository\ cwiki-us\ codebank-scala\ out\ production\ codebank-scala;C:\ Users\ Yucheng\ Dkits\ scala\ lib\ scala-library.jar;C:\ Users\ Yucheng\ Dkits\ scala\ lib\ scala-parser-combinators_2.12-1.0.7.jar C:\ Users\ Yucheng\ Dkits\ scala\ lib\ scala-reflect.jar;C:\ Users\ Yucheng\ Dkits\ scala\ lib\ scala-swing_2.12-2.0.3.jarscape C:\ Users\ Yucheng\ Dkits\ scala\ lib\ scala-xml_2.12-1.0.6.jar "HelloHello.Worldman process finished with exit code 0"
The result of the program running is shown above.
At the beginning, it is about the configuration of your system path.
Https://www.cwiki.us/pages/viewpage.action?pageId=41686101
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.