Eclim not detecting main-class any more? - vim

Eclim daemon is running.
:PingEclim yields
eclim 2.3.2
eclipse 4.3.1
File: Foo.java
public class Foo {
public static void main(String[] args) {
System.out.print("Foo");
}
}
By running :Java, I am presented with the error
java.lang.RuntimeException: Required setting 'org.eclim.java.run.mainclass' has not been set.
Now, I know I can manually set the mainclass in the project settings, but this used to work just by running :Java. Additionally I can add that running :Java % is not working either. It simply seems incapable of detecting my main function.
Update
Included the output of :Java % below.
Error: Could not find or load main class .Foo
[java] Java Result: 1
Update 2
It seems Eclim sets the main class the first time it detects and runs a Main function inside a Project. After that, trying to manually run another class containing a main function will result in the above error. Not sure how to work around it, but it should really be possible to not be locked to the class that is run first.

I had the same problem too. Then I found out that if the main class is included in a package, you have to use the full qualified class name. For example, if your main class starts with:
package a.b.c;
Then use the setting:
org.eclim.java.run.mainclass = a.b.c.Foo
After that, it should work fine.

i am having the same problem . i compared two projects one was made by eclim and other in eclipse and found .
.classpath file on :
eclipse
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
eclim
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
so i tried to change it to the one like eclipse and it worked .

Related

How to hide Tomcat version from error messages when using embedded servers in Java

I have a java application where i'm using embedded Tomcat servers,
which looks like this
Tomcat tomcat = new Tomcat()
I'm creating an embedded tomcat server here.
Problem statement
whenever there's an error it displays information on which tomcat version i'm using,
how to hide this in java?
i have a little idea that i need to override ServerInfo.properties, but how do i do this?
I'm not sure how we can do this in java, but if you are using any build scripts like ant / gradle for distribution purpose, we can write a task to override / harden the jar file, and replace the ServerInfo.properties file with the customized value whatever we need.
the code for ant build scripts would look like
<target name="override.tomcat">
<jar destfile="path/to/tomcat-embed-core-9.0.62.jar" update="true">
<fileset dir="src/"> <!-- folder where you keep the directory/file to raplace-->
<include name="org/apache/catalina/util/ServerInfo.properties"/> <!-- file to replace within directory path in side the jar-->
</fileset>
</jar>
</target>
and in gradle
task overRideTomcat(type: Jar) {
from(zipTree(file("path/to/tomcat-embed-core-9.0.62.jar"))) {
exclude '**/org/apache/catalina/util/ServerInfo.properties'
}
from('src/') {
include('/org/apache/catalina/util/ServerInfo.properties')
}
archiveName "tomcat-embed-core-9.0.62.jar"
}
make sure you have the modified ServerInfo.properties file under src directory in the same path as you have mentioned in the include statement.

Android Studio - FindBugs excludeFilter file is working for IDEA plugin, but not for Gradle plugin

I have the following exclude filter to ignore all R file classes:
findbugs-exclude-filter.xml
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<Match>
<Class name="~.*\.R\$.*"/>
</Match>
</FindBugsFilter>
When I use it for the FindBugs-IDEA plugin it works.
However, when I use it for the FindBugs Gradle plugin, in a task like so:
build.gradle
apply plugin: 'findbugs'
task myFindBugsTask(type: FindBugs) {
.....
excludeFilter = file("$project.rootDir/findbugs-exclude-filter.xml")
.....
}
I get an error with the message: Cannot read file specified for FindBugs 'excludeFilter' property:. The report is still successfully generated, but the filter didn't take.
I've tried EVERY solution I found on the interwebs (most of which are very outdated) and I get the same results.
So what gives? Is this a known bug? Am I the only one experiencing this?
So I found a workaround if anyone is encountering the same issue. The concept is to submit a filtered file tree. My task now looks like this:
apply plugin: 'findbugs'
task myFindBugsTask(type: FindBugs) {
.....
FileTree tree = fileTree("$project.buildDir/intermediates/classes").exclude('**/*R$*.class')
classes = tree
.....
}
Here is the correct filter:
<Match>
<Class name="~.*\.R(\$.*)?" />
</Match>
This marches all R classes and inner classes.

Unexpected namespace prefix “custom” found for tag fragment while trying to use custom attributes

I am following this android developer page for the creation of custom attributes for an app. Everything is going fine and I am able to compile and see the results also.
But the part which is giving issue is IDE.Android Studio is complaining for unexpected namespace custom. Is there any way to disable/hide this error message? This is very annoying.
Even with this error, however, I am able to compile and run the app.
I followed follwing steps.
1) Created res/values/attrs.xml file and added
<?xml version="1.0" encoding="utf-8"?> <resources>
<declare-styleable name="FragArguments">
<attr name="max_allowed" format="integer"/>
<attr name="header" format="string"/>
</declare-styleable>
2) Trying to use in my mainlayout file's fragment tag
<LinearLayout xmlns:custom="http://schemas.android.com/apk/res"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1">
<fragment android:id="#+id/msg"
android:name="org.android.fragment.MessageFragment"
custom:max_allowed="85"
custom:header="#string/header"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
</LinearLayout>
3. Applying the custom attributes through code overriding the onInflate() method of fragment
#Override
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
super.onInflate(activity, attrs, savedInstanceState);
TypedArray typedArray = activity.obtainStyledAttributes(attrs, R.styleable.FragArguments);
max_allowed = typedArray.getInt(R.styleable.FragArguments_max_allowed, -1);
header = typedArray.getString(R.styleable.FragArguments_header);
typedArray.recycle();
}
I just figured out the solution.
The issue ID MissingPrefix tells lint to only scan for XML attributes that are missing the Android namespace prefix.So we can do this two ways:--
Canissue the following command to scan the files under the main project directory and its subdirectories.
lint --check MissingPrefix myproject
In android studio create a lint.xml file with following content and add in app directory.
<?xml version="1.0" encoding="utf-8"?>
<lint>
<issue id="MissingPrefix" severity="ignore"/>
</lint>
Thanks to #Nicks answer. You can also add following lines to the build.gradle file, inside android {} scope:
lintOptions {
disable 'MissingPrefix'
}

j2me emulator error

I am using kemulator to run j2me game (my own developed) when I try to run it i get an error which says "can not find MIDlet class plz check jad or use -midlet param"
Classpath
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="res"/>
<classpathentry kind="con" path="J2MELIB"/>
<classpathentry kind="output" path="bin"/>
</classpath>
There is a package org/rhynn/ and there`s no such thing as a src folder in myGame.jar. I am using Eclipse ME to export this game.
actually there is no res or src folders in that jar. PS : Im new at those Manifest and other (except Java ME) so I dont know what to do.
A j2me application or game must have at least one class that extends MIDlet. Take this class full name, for example, org.rhynn.MyGameMIDlet and pass it to -midlet param.
try using ant and antenna to pack jar file

Magento Getting Fatal error with custom module

I am getting following error :
Class 'Lucky_Test_Helper_Data' not found in E:\wamp\www\raj\magento_new\app\Mage.php on line 521
I created this module using module creator.
I checked it with one of my magento installation, it worked fine. Then I copied the module to the actually installation where I wanted to use it.
I did a some debugging, and found that if I comment certain part of config.xml I get no error.
I figured that out after having a look at stack trace of error, which included following line.
include( 'E:\wamp\www\raj\magento_new\app\design\adminhtml\default\default\template\page\menu.phtml' );
here is my config.xml
now if I comment :
<!--<test module="test">
<title>Test</title>
<sort_order>71</sort_order>
<children>
<items module="test">
<title>Manage Test </title>
<sort_order>0</sort_order>
<action>test/adminhtml_test</action>
</items>
</children>
</test>-->
I get no error. Module seems to be loading fine till this point.
Do you see anything wrong?
Help me out.
You have to explicitly define that you are using helpers, like this:
<global>
<helpers>
<test>
<class>Lucky_Test_Helper</class>
</test>
</helpers>
</global>
In the menu you define with module="test" that your module handles the translation for it

Resources