Running Java application in Android Studio - java

I created new libgdx project and i want to run desktop application in Android Studio. Is there something to do with run configurations? In Eclipse i can just choose Run as Java Application.

Ok, i did it. Here is the solution https://github.com/libgdx/libgdx/wiki/Gradle-and-Intellij-IDEA#running-your-project
Run -> Edit Configurations..., click the plus (+) button and select Application.
Set the Name to Desktop.
Set the field Use classpath of module to desktop, then click on the button of the Main class field and select the DesktopLauncher class.
Set the Working directory to your android/assets/ (or your_project_path/core/assets/) folder!
Click Apply and then OK.
You have now created a run configuration for your desktop project. You can now select the configuration and run it.

Right click on the main method (or anywhere in the main class) and select Run.

Related

Netbeans No Main classes found

Yesterday I downloaded JDK and Netbeans as my IDE. When I attempt to create my first ever Java project, I get
"no main class found"
as shown by the screenshot below
What do I do for the correct setup please?
I have since clicked on Properties>Run
and still have the same problem.
The syntax errors are shown in the screenshots below.
Would it have anything to do with my setup of src folder?
Right click on your Project in the project explorer
Click on properties
Click on Run
Make sure your Main Class is the one you want to be the entry point.
Click OK.
Run Project

Eclipse rcp show different layout in Launch and exported file

I'm using Eclipse Luna for creating RCP Application. I set product configuration file for plug-in project. When I run application by click Launch button (Launch an Eclipse application) from Overview page, (1) it keep show old code, not changed one.
So, I exported my application. The first time works find and then second time this one also doesn't show changed codes. I have to remove folder every time for checking updated codes.
Please, someone help me to figure out these issues. It's really bugging me.
Keep showing old code from Launch an Eclipse application & Eclipse Product export wizard
Launch and exported file show different layout
From Launch
From exported file.
I found to run with updated source after exported files. Do uncheck "Generate p2 repository" & "Allow for binary cycles in target platform" when opened Export dialog. After unchecked it them I could get updated files. It looks it happened for application version managing (P2 Folder).

Android on Intellij showing error: is not an activity

I have just imported my android project into intellij from eclipse. I am new to intellij.
I have gotten everything working and set up the run configuration for Android. When I run it, it gives me the edit configuration screen.
When I say launch the default activity, it tells me that it can't find the default activity, which is odd. When I code the activity to launch straight away, it tells me that that's not an activity subclass or alias. I double-checked and the class is certainly an activity.
When I ignore it and run anyway, it blows up as soon as it hits the phone.
Can you help me understand/fix these errors, please?
In the Intellij project structure dialog, select the module that your Activity is residing in.
Then under the sources tab, add the root folder of your sources as sources for this module by clicking the 'Mark as Sources' link or button. The sources root folder should be mark blue.
The module can now find your sources and launch the activity.
My solution was to delete and recreate the run configuration.
In my case, none of these solutions worked. Then I started digging.
As I remember, my java files had to be placed in src/main/java/com.something.blabla. Then I realized that the directory has changed to src/main/java/com/something/blabla.
So I created a new com.something.blabla folder under ../java/ and moved my java files to that folder. I removed the com folder, and it worked perfectly.

Project Selection in Run Configurations on Eclipse is Empty

I'm a newbie in Android Development. And I have this one tini-tiny problem which I'm not able to fix it. Every time I run configurations, and browse the Project name, the Project selection is empty and I cant click on any on it except the "Cancel" Button. Then I can't really launch my project. How does one fix this?
Right click on your package in the Package Explorer, click Properties, and see if you're using any libraries. Make sure that the "Is Library" box is not ticked on your project.
In my particular case I had a Maven Project Loaded into Eclipse Mars, and when I tried to run a specific main class, the project itself didn't appear in the Project List under:
Configurations -> Java Application -> Project -> Browse...
What I did was just to convert the Project to have Facets... in the Project Properties:
Main Menu -> Project -> Properties -> Project Facets
Once I did it, just selected Java and the version I needed and it started working.
In the Java Perspective choose the Run menu and go to Run Configurations
Select the item in the list titled "Android Application" and press the plus/add button.
On the next page, choose the Browse button and choose the Android App that you'd like to run.
I had the same problem and found I hadn't put the project name in Project textbox, in the first tab.

"Run as" android application is missing

SDK and ADT are installed and working, but when I run some android code, the "Run As" panel is empty. I need to go to Run configuration, click on Android application, make a copy, put the name of my project on the copy and the run it. Then it run properly on the emulator. How can I add the "android application" item menu inside the run as menu?
You could Right Mouse Button Click(on activity class) > Run As > Run Configurations. Next is Right Mouse Button Click on Android Application > New. Now you should add your virtual emulator in Target. It works in my version of IDE.
Now you can use this run configurations with your own settings.
"Run as Android application" is available if u run the project (right click project name and u have that option) , and not a specific activity file ..
Just select Run > Run in eclipse and select android application.The Eclipse plugin automatically creates a new run configuration for your project and then launches the Android Emulator.
Maybe this is a bit late to be answering this, but I think my answer is better. The right click is all fine and well, but it is a bit more effort each time than my suggestion.
Right click on the toolbar and click "Customise Perspective..."
On the toolbar structure that pops up find "Launch" (On mine it's the 5th item down - it might vary)
Then you need to tick the "Run " box
After you click "OK" it should be back in the toolbar and in the menu

Categories