Algotrader open source project not recognized as java project in eclipse - java

I have downloaded the open source edition of AlgoTrader from google code and imported it in Eclipse. There are two project algotrader and algotrader-strat. But the problem is that they are not recognized by eclipse as a java projects. I realized that when I tried to add a jar file and build the path. There is not ā€œJā€ on the project folder. So my question is there a way eclipse to recognize these projects as java. And if yes how can it be done?
Thanks.
https://code.google.com/p/algo-trader/wiki/AlgoTraderDocumentation#Installation

As it uses maven, maybe you can just regenerate the Elipse project files. Something like:
mvn eclipse:eclipse

I just did a quick look at the mentioned projects (I do not know them).
From what I can see, the directories you imported are the parent projects (from a Maven point of view), whose modules are in some sub-directories. For example the algotrader project contains a sub-directory called code. This one is an Eclipse project that can be imported.

Related

How to identify project type from project folder

Recently i have received a project as a zip. I have unzipped and now i want to import the same in eclipse. But am unable to identify what type of project(maven, java, gradle, etc) it is. I have tried importing as existing project into work-space. But its not identifying as a project when searching in eclipse.
For maven projects, it will have a pom.xml, this one don't have one.
Similarly is there any other ways to identify what type of project it is from the project folder?
Thanks in advance!
I have received partial answer from the commends of #Sangeeta and #carchingUp. I want to add all details to a single answer so that it will be helpful to others.
Inputs from Sangeeta: if pom.xml is present you can infer its a maven project. If build.sbt, then its an sbt project. If build.gradle, You can know its a gradle project and build.xml for ant projects
In my case i was having build.xml from which we can identify as ant project.
When you import the project as ant project to eclipse and if you have the below scenario,
"package name is com.abc.xyz, present in src/main/java and when importing as ant project, main.java.com.abc.xyz becomes the project and am getting error for all the java files for package name mismatch", follow the below steps.
right click the src folder >build path >remove from build path
right click the java folder > build path > use as source folder.

How to see source code of jar attached through maven dependency

I am working on maven project in eclipse and I have some 7-10 jar files. I have added dependency of those jar files in my POM file. But when I click any function which is part of libraries, my eclipse complains that no source code found. All jar files are successfully downloaded in my local maven repository. I am struggling to attach source code. I have already tried downloading sources and Javadoc under maven but it is still not working.
You can use a tool to decompile .jar files, for example this.
Other option is use the Jetbrains IntelliJ IDE that includes a potent decompiler right out of the box.
Please check if you have Maven Dependencies on your build path
I suggest you use more popular IntelliJ IDEA IDE rather than eclipse, you can view jar source code easily.

"Could not find or load main class" after removing Maven nature and files (pom.xml, target/) from an Eclipse Project

I accidentally converted my project to Maven by going to Configure > Convert to Maven Project. Now I want to undo this. I read that I need to right click Maven > Disable Maven Nature and that worked fine. However I want to totally remove Maven, so I deleted the pom.xml and the target folder. When I try to run my code now, I get the error:
Error: Could not find or load main class
So what am I missing? How do I revert from a Maven project to a non-Maven project?
When you convert a Java project to a Maven project in Eclipse, the Maven Integration for Eclipse (m2eclipse) configures the Java incremental compiler to put the compiled class files in the same location as Maven would put them, i.e. target/classes.
So when you remove the Maven nature and delete the target folder, you now also have deleted the compiled class files and your project can no longer run. AFAIK, the incremental compiler doesn't detect when you remove its output files, so you need to trigger a rebuild by cleaning the project (Project > Clean...)
This will fix the problem that you can not launch your project, but may re-create a target folder. If you also want this to be "fixed", you can switch back to some other folder name for the binaries, e.g. bin, in the project's Java Build Path configuration on the Source tab.
Is it basically a Maven project, i.e., do you have and maintain it through a pom.xml? Then my suggestion is to delete the project in Eclipse but keep the files on the disk (i.e., it removes it from the workspace). Then, run a simple mvn eclipse:clean eclipse:eclipse which creates a simple Java project without the Maven nature based on the POM (so the libraries are linked and the source/output directories are set up correctly - this may solve your ClassNotFoundError).
If it's a simple Java project, I would advise deleting it from the workspace, removing the .classpath and .project files and importing it again with the Create a Java project with existing sources wizard.
Either way, make a backup of your project before you start doing anything :-)

Can Eclipse build specific packages in a project?

I'm curious if there's a way to build specific packages in eclipse. For instance, if I have a project with a src folder containing
com.example.a
com.example.b
com.example.c
Is there a way to build/compile just com.example.a and com.example.c? I know there's a way to do it in ant, but hopefully there's an eclipse solution too.
Yes.
File
Export...
Java
Jar File
There you can select exactly what to build in Eclipse.
For exampe check only com.example.a and com.example.c.
You can exclude com.example.b from the build path.
For different builds/packages/assemblies (jar files?) you should use ant. That's one reason why it is integrated in eclipse.

Import an IntelliJ IDEA project into NetBeans?

How can I import an IntelliJ IDEA project into Netbeans?
I know I can just use IntelliJ but I prefer Netbeans...
With this particular project I can't just copy the source directory into a Netbeans project... That doesn't work?
How may I use this IntelliJ IDEA project within Netbeans?
The nbproject is a required folder by NetBeans, where it keeps its project settings. The only necessary project build files needed are the project.xml and project.properties.
In project.xml, line 5 is changed to reflect the accurate name of the user's project. Also for IntelliJ, nbintellij.iml is the required file.
So for a IntelliJ project, if you create the nbproject folder with the required files (project.xml and project.properties), you'll be able to open the folder in NetBeans
You can use the following tool I've created to convert an IntelliJ project to NetBeans, and also convert a NetBeans project to IntelliJ. Please make sure you have python installed.
https://github.com/devanshkaloti/IDEProjectConverter-Java
Short answer: I don't believe such a tool exists.
Longer answer: You probably should not be relying on a proprietary format for your project. Depending on the project, Ant+Ivy or Maven may be a better solution.

Categories

Resources