Ameba Ownd

アプリで簡単、無料ホームページ作成

Gwenda Briggs's Ownd

How to run downloaded .java files on intellij

2021.12.19 11:28






















In this tutorial, we're going to do everything from scratch, so click Next. If necessary, change the default project location and click Finish. Packages are used for grouping together classes that belong to the same category or provide similar functionality, for structuring and organizing large applications with hundreds of classes.


In the Name field, type com. HelloWorld and click OK. In this case, the IDE has inserted the package statement and the class declaration. This is done by means of file templates. Depending on the type of the file that you create, the IDE inserts initial code and formatting that is expected to be in all files of that type. For more information on how to use and configure templates, refer to File templates.


Type main and select the template that inserts the main method declaration. Live templates are code snippets that you can insert into your code. Usually, live templates contain blocks of code that you use most often. Using them can save you some time as you don't have to type the same code over and over again. For more information on where to find predefined live templates and how to create your own, refer to Live templates.


Let's call a method that prints some text to the standard system output. Type Sy and select the System class from the list of code completion suggestions it's from the standard java. Type p , select the println String x method, and press Enter. This information is for your reference. Type ". The second quotation mark is inserted automatically, and the caret is placed between the quotation marks. TimNeutron TimNeutron 85 2 2 silver badges 8 8 bronze badges.


I don't have a. And sorry about that, here I will upload another link I don't know if I can post pictures here? So, you have a class, you don't compile it, and try to run it? I recommend you to first learn the basics. Trust me: skipping the first ten chapters of your textbook because they're boring does not make you learn Java faster. Show 2 more comments.


Active Oldest Votes. Trevi Awater 2, 2 2 gold badges 27 27 silver badges 48 48 bronze badges. Ashish Yete Ashish Yete 41 1 1 silver badge 7 7 bronze badges. I know that, I wrote it that in the screenshot it doesn't but adding it is not going to change anything, it still looks the same: prntscr.


Add a comment. Meo Meo And now you will be able to use these files as normal class files. I just saw your code and looks like you are far away from what you need.


Let me give you some tips: Try use a good IDE like eclipse Study about how to create and use a main method Study how to set in eclipse to use the main method when you run your project Study how to export your project a runnable jar if you are thinking in a desktop app Check if JAVA is installed in you machine If my question is helpful give a up vote.


Igor Igor 91 1 1 silver badge 12 12 bronze badges. And also can I ask why are people down voting my question? Did you read the part of my comment about main class? About the down vote, I hate when people use down vote and do not add a single comment explaining why.


Roy Roy 1, 1 1 gold badge 14 14 silver badges 11 11 bronze badges. Something else that worked for me: Right click the folder in src containing your main You'll see an option "run 'file. Click it, and then the run icon in the top right and bottom left will turn green from then on.


Sometimes, patience is key. So I waited for the indexing to finish and only then I was able to run my main class. Arnaud Claudel Arnaud Claudel 2, 15 15 silver badges 21 21 bronze badges. Click on Edit Configuration and just do following steps-: Click on add icon and select Application from the list.


In configuration name your Main class: as your main class name. Set working directory to your project directory. Others: leave them default and click on apply. Now you can run your program. Dipesh Chauhan Dipesh Chauhan 21 1 1 bronze badge. Last resort option when nothing else seems to work: close and reopen IntelliJ.


Kartik Chugh Kartik Chugh 12 12 silver badges 26 26 bronze badges. This was a good hint for me but it seems like this may be for a different version than I have but I'm not sure. I clicked an "Add Configuration" button near the top right of the app. From there I selected "Application" then filled out the project name and the specified the main class. I also checked the "store as project file" option to save the settings, perhaps. After clicking Apply I am now able to run the project.


Then cut and paste all your package in that folder. Niraj Kulkarni Niraj Kulkarni 25 1 1 silver badge 5 5 bronze badges. If you use Maven, you must to declare your source and test folder in project directory. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.


Email Required, but never shown. The Overflow Blog. Who owns this outage? Building intelligent escalation chains for modern SRE. Podcast Who is building clouds for the independent developer? Featured on Meta. Now live: A fully responsive profile. Reducing the weight of our footer. Linked