How to run an eclipse project without eclipse - java

I don't have eclipse installed. I have a Java project with an eclipse folder in it.
Can I simulate pressing the Run button in eclipse, without installing eclipse.
I want to run this project.
I am on macOS. It's a pretty huge project, I am not sure how to compile the source correctly. I also don't know what external dependencies this project has.

Without an external build tool to help with building the application like Gradle or Maven, you're going to have to download a copy of Eclipse and run it from there. You'll also need to take the time to ensure that you convert your project to either a Maven or Gradle-based project so that you can build it independent of what IDE you're using.

Related

How to link compile error to java source in eclipse ide running a maven project

I am quite new to eclipse and want to develop a maven project in java.
Compilation from within eclipse works but
If i get a compilation error on the eclipse console,
there is no link to the source code.
I would expect eclipse to have such a link.
Does it exist? and if so, how to activate it???
Maybe the problem is, that i already have a maven project
and now want to use eclipse on it.
If you're developing a Maven project in Eclipse, you should create it as a "Maven Project", which will utilize the "m2e" or "maven2eclipse" plugin. When you do it this way, then Eclipse will use the same source folders your Maven build will use (defaulting to src/main/java and src/test/java), and Eclipse will look at the dependencies specified in the pom.xml file and make sure those dependencies are all downloaded and available for the Eclipse compiler. If this is all done properly, then if there are any red marks in the project, then those represent the same compile errors that you would get if you built the Maven project from the command line. Watch out for any red marks in the pom.xml file itself. When that happens, Eclipse doesn't attempt to compile anything.

Is it possible to build an Eclipse Workspace with the command line in Linux?

Is it possible to generate an eclipse workspace using command line so that I can simply switch the workspace in Eclipse and everything is configured? I've already tried many approaches (using mvn eclipse:eclipse which only generates .project files but no workspaces, using the eclipse osgi jar) but I didn't get any of them to work...
mvn eclipse:eclipse is an old an deprecated command. The functionality of this and much more was replaced by Eclipse Oomph. This allows you to just define which plugins and which eclipse version you want and then on the developer computer these things could happen:
install eclipse
install needed plugins
checkout the projects
create files
set specific eclipse settings
build your project
I would suggest not to compile class files on a build server and move them afterwards to a developer PC. I see potential problems in debugging and profiling when the compiler is not exactly the same.
Another approach would be to create the Eclipse installation in a virtual machine (or docker container), deploy the image on the build server, build it there and then distribute the image to the developers.

How to export a java project from eclipse that contains all libraries required to compile?

For a project I completed a game in Java on Eclipse using LibGDX. I now need to turn in the source code to my professor. When I export the project and try opening it on a new computer, about a dozen libraries are missing.
I would like to export my entire project so that when the project is opened in eclipse, it will still compile. Is there any way to do this? I know that runnable jars come with the .jar files of the dependencies and no source code, but I need both.
Thanks in advance
Libgdx required number of dependent jars so it's hard to manually add all jars into project.
Make your project gradle based so that When you import your project through gradle into another System then gradle do most of your task* for you.
*gradle try to find dependent jars in file system if already exist then link with your project if not then it download from given repository and link them in your project. Make sure your system is connected with internet when you build your project.
I highly encourage to use Android Studio or IntelliJIDEA.
On window, by default all jars are stored inside
C:\Users\User_name\.gradle\caches\modules-2\files-2.1
In Mac OSX
/Users/User_name/.gradle/caches/modules-2/files-2.1
When you want to deploy or packaging for the desktop run this command on your IDE terminal.
gradlew desktop:dist
You can use maven or gradle to build your project, take a look of one of the tool and it's won't take you too much time. these tool could help you define your own way for build
A much easier way you could use "fat jar". this is an old tool for build a jar with all lib you need and could be run in any place.

using eclipse and netbeans on git

I am trying to work with a partner using a git repo. He uses netbeans but I use eclipse. I am having problems when I import the project into eclipse, the project has no classpath folder in eclipse so it cannot run and it is not highlighting errors in the code.
My question is is there anyway to work on the same git project with two different IDEs? And if so, how do I get eclipse to recognize the netbeans project folder to create its own .classpath.

Create Eclipse java project with a java programm

I would like to generate Eclipse Java Project with my Java program. When I click a button: it will generate an eclipse project with the parameters I specified (source path, library, ...)
My questions are:
is there a way to do that ? and how ? (api).
it is possible to generate Net-beans project too ?
Best regards,
Florent
Maven enables this and many more things around creating, bulding, testing and developing Java projects.
Create a Java project from command line. Then, using Maven create NetBeans, Eclipse or IntelliJ IDEA specific project files. Or even easier, just import already created Maven project directly from these IDEs.
Create Java Project in Eclipse first. Then look into directory created. You should find there two files: .project and .classpath. These are the files you should create in your app to get what you want.
Also for eclipse available M2Eclipse plugin to provide some Maven feature from Eclipse IDE.
http://m2eclipse.sonatype.org/
While Maven is the way to go in the long term, the best way to start a project in Eclipse is:
Hit Ctrl+N and choose Java project
Fill in the project name fields
Copy your files from wherever they are to the newly created project (ensuring to preserve package hierarchy)
Refresh project from File menu
Create a Run / Debug profile to run your app.
It should be fairly simple to get up and running this way.
The reason people recommend Maven is because Eclipse is an IDE. It's great for development but its no good for resolving external dependencies or for command line / automated builds. Maven is an IDE neutral way of building and becomes essential the more dependencies a project pulls in.
Unfortunately Eclipse integration with Maven is pretty clumsy and can be summarized with these very broad steps:
Install Eclipse Helios
Install m2eclipse from the Help | Eclipse Marketplace
Mess around with eclipse.ini to make Eclipse start from a JDK.
Configure m2eclipse to use any existing Maven local repository
Hit Ctrl+N and create a new Maven project and skip archetype selection
Copy all the source files from the old project into the new ensuring to use Maven's conventions for file locations. (e.g. source goes in src/main/java)
Create a Run / Debug maven target to clean / install the app
I say broad steps because there are a lot of gotchas. For example if the source is Java 5+ you might have to tweak the pom to set the compiler level. Best to get Eclipse working and then worry about Maven.
Netbeans has vastly better out of the box support for Maven although IMO Eclipse is still the better IDE for other reasons.

Categories