How can I remove old projects in Launch Configuration(Eclipse) - java

I made a java project(using eclipse) and tried to make it as runnable jar file(export)
Package Explorer -> right click the project -> select "Export" -> select "Runnable jar"
Then export window is created
You may see Launch Configuration, which is list of projects.
In this list, old projects is appeared. I do not use these projects anymore, so I want to remove this projects in list(Launch Configuration)
How can I delete it?

Open the 'Run > Run Configurations' menu. You can manage your configuration there.
If the launches are not listed there you will have to delete them manually from the workspace '.metadata/.plugins/org.eclipse.debug.core/.launches' directory.

Related

Import .jar to IntelliJ Java project

I made a customised data structures class library and I want to pack it as a .jar file and then use it on another project. My IDE is IntelliJ.
How can I make the .jar file and then import it on my other project?
Open the project that you want to pack as a jar.
Go to File -> Project structure.
Select the Artifacts menu.
Click on the green plus and select JAR -> From modules with dependencies... click Apply and then OK.
Go to Build -> Build artifacts... -> Build
Copy the .jar file that can be found in out/artifacts/<name>/<name>.jar
Open your other project where you want to use your jar file.
Create a folder named lib/ and put your jar file there.
Go to File -> Project structure.
Select the Modules menu on the left and the Dependencies tab.
Click the green plus on the right side, select JARs or directories... and then select your jar file.
You are ready to go.

Build path entry is missing: /src/test/java

While running my java project on Eclipse Luna, I have some errors due to which I suppose related to this problem.I right click on the project, choose properties --> java build path --> source, I see a warning at the top:
And it seems that I have forgotten to add this package at the beginning of my project.I want to add it now, but I cannot do it via "Add Folder" button.When I press "Add Folder" button, a window appears like this one:
However, I believe I should add it under "Java Resources" on the tree:
How can I modify this?
Thanks for any help..
src/test/java is just maven's default entry for any test classes. If you have (or plan to have) test classes, you can create a new folder structure test/java below your src folder and afterwards select it in the dialog you've shown. If you don't plan to have any test classes, you can safely remove the entry from the build path.
This worked for me:
mvn clean install
How to add missing src/test/java folder to the maven project in Eclipse
1) Create a folder test/java under src folder
2) Right click on the project and choose Maven --> Update Project --> choose for Force update of Snapshot/Releases and click ok. Now test folder should appear as src/test/java in Eclipse project explorer

How can i import a Eclipse launch-group configuration into another workspace along with project

I have created a launch group configuration for launching a project in my current workspace.
Can i some how save the configuration along with the project so that it can be imported into another workspace ?
If no how can i create a launch-group configuration using a custom eclipse plugin ?
Export
File -> Export... -> Run/Debug -> "Launch Configurations"
Then select the configurations you need to export.
Import
File -> Import... -> Run/Debug -> "Launch Configurations"
Then select the configurations into "From Directory".
Example images are available here along with a sample .launch file.
I simply export all my "run/debug configurations" from the original project by:
copying the content of folder:
$My-Workspace\.metadata\.plugins\org.eclipse.debug.core\.launches
into a folder in the destination project (folder location or name doesn't matter, just as long as it is in the imported project)
and when I open eclipse to my workspace and the project - it will show up automatically in "run/debug configurations" dialog (eclipse scan the projects for .launch files)
also after copying a .launch file into my project, i right click the root folder and choose refresh, wait for a minute and the configurations appear in the "run/debug configurations"

How to reflect another project's class info

there are two projects in eclipse! how to reflect one class in other project? I put other project's class path into system's property. but still popup class not found exception. Is there any good solution for it?
System.out.println(System.getProperty("java.class.path"));
System.getProperties().put("java.class.path",
System.getProperty("java.class.path") +
";C:\\Users\\fu.jian\\workspace\\Study\\bin");
System.out.println(System.getProperty("java.class.path"));
Class<?> forName2 = Class.forName("study.Activator");
System.out.println(forName2);
Right click the project to bring up the context menu.
Build Path->Configure Build Path
Under the Java Build Path dialog, select the Projects tab and add the project.
Try to add the project B to classpath of project A by:
In Eclipse click on project A -> mouse right click and select Properties -> Select Java Build Path -> Select Projects tab -> Click on Add... and check project B
The problem will be resolved inside Eclipse, if you use external tools for compilation and building the project - your problem will still appear.
You can export the project B as jar and copy the jar into the project A libs. This way you won't depend on Eclipse.

How to achieve that Eclipse clean and build (aka rebuild)?

I deleted my ./bin folder in an Eclipse Indigo (super similar to Helios), and now I am wondering how to rebuild my Java project. I just cannot find a button like we can see in Netbeans.
For Eclipse you can find the rebuild option under Project > Clean and then select the project you want to clean up... that's all.
This will build your project and create a new bin folder.
In Eclipse there is an "Auto Build" option, which is checked by default. When it is checked, you don't need to build your project, this happens automatically. If this behaviour is unwanted, uncheck this option and click build project whenever you want.
To clean a project, select Clean Project. This will delete the bin folder, however if Auto build is checked, it will be immediatelly regenerated.
In case you are unable to find a file in Eclipse code after pulling code from git or creating a file in intelliJ seperately (my case) you ca do the following
Right click on 'src' folder and in the menu that appear click on the 'refresh' button

Categories