Run java class for simple Java project from Android Studio?

I have a java library project for android studio (1.3). It has one class:

package com.me.test;

public class Hi {
    public static void main(String[] args) {
        System.out.println("hi.");
    }
}

      

I have a Run setup for an application for this class. The settings from the config file are selected using the IDE kit, I didn't add it manually:

Main class: com.me.test.MyClass
Working Directory: parent folder (tried every sub folder as well)
Use classpath of module: MyOneAndOnlyModule

      

When I run the config it works fine one time. When I run it a second time, I get a ClassNotFoundException:

Exception in thread "main" java.lang.ClassNotFoundException:
  com.me.test.Hi
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    ...

      

I uninstalled android studio, downloaded ok and can run the configuration OK once. The second time the crash starts again.

I just want to be able to run a java class from android studio without having to reinstall the IDE every time.

Right clicking on a class in the project tree and then selecting a launch configuration also results in the same class exception that was not found.

thank

+3


source to share





All Articles