preference extension package to jar - eclipse

http://www.eclipse.org/articles/article.php?file=Article-Preferences/article.html did somebody see this paper? and I executed the example, it is run as eclipse application successfully, however when I packaged it to jar and pushed the jar package to eclipse's plugin directory , there was no effect in eclipse, thanks for your anwser

You don't seem to have the plugin.xml (and possibly other things) in your build.properties. A more or less standard build.properties for a plug-in would be:
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
plugin.xml
OSGI-INF can be left out if you don't have that folder.

Related

Eclipse E4 application does not build correctly

I have an E4 application that contains two different plugins.
The second plugin holds all my shared models and those models are used in my first plugin.
When building and starting the application using Eclipse run functionality everything works fine. All the classes in the second plugin are found and use by the first plugin.
Now when I export the full application into an executable. The export itself doesn't give any errors but when starting my application it throws errors that the classes in the second plugin cannot be found. When I check the exported jar of the second plugin I can only find the source code in the jar, not the builded class files itself.
Are there some steps to also include the class files to the second plugin jar?
My build.properties of my second plugin looks like:
source.. = src/
bin.includes = META-INF/,\
libs/hibernate-c3p0-5.1.1.Final.jar,\
libs/hibernate-commons-annotations-5.0.1.Final.jar,\
libs/hibernate-core-5.1.1.Final.jar,\
libs/hibernate-java8-5.1.1.Final.jar,\
libs/hibernate-jpa-2.1-api-1.0.0.Final.jar,\
libs/lombok.jar,\
libs/logback-core-1.1.7.jar,\
libs/slf4j-api-1.7.21.jar,\
libs/jboss-logging-3.3.0.Final.jar,\
libs/jta-1.1.jar,\
libs/javassist-3.21.0-GA.jar
Assuming you have code in a source directory you need to have a . in the bin.includes to include that code in the build:
source.. = src/
bin.includes = META-INF/,\
.,\
libs/hibernate-c3p0-5.1.1.Final.jar,\
..... other libs ....
The build.properties is only used when doing the RCP build so you don't get an error for this when you run your RCP from within Eclipse.

how to create project files in sbt

hi i am new in sbt i am following this tutorial
http://www.scala-sbt.org/0.13/tutorial/Hello.html
i followed the same steps on the shell the program displays "hi"
i am confused i don't have these files in my hello folder
Sources in src/main/scala or src/main/java
Tests in src/test/scala or src/test/java
Data files in src/main/resources or src/test/resources
jars in lib
and also i dont't have the build.sbt file i am following this tutorial as it is i have only hw.scala file and a target folder
mt scala version is 2.11.1 and sbt version is sbt 0.13.5
am i doing something wrong ?
Just create build.sbt and write appropriate lines into it. Same goes for mentioned directories -- stock sbt does not create files and folders for you, but it has to recognize them, once they're there.

Trouble running jar file created by Eclipse

I exported my Eclipse project as a runnable Jar file, added a manifest, as well as the appropriate class files with the command:
jar cfm JarFile.jar manifest.txt *.class
However, when I try to run the jar file with
java -jar JarFile.jar
I get the error that it "Could not find or load main class" etc. etc.
The structure of my manifest.txt file looks like this:
Main-Class: EclipseProjectName.src.packagename.mainclassname
(With a carriage return at the end)
Is something wrong with my manifest file? If not, what may be the reason that the main class cannot be found?
Thank you!
The manifest file extension should be .mf i.e manifest.mf. See here for jar file specification
Suggest to use fat jar eclipse plugin for exporting java projects as runnable jars.
Edit
Correct the content of manifest.txt as shown below
Main-Class: EclipseProjectName.src.packagename.mainclassname
project name and src are not required. Refer this
The entry in the META-INF/MANIFEST.MF entry in the finished jar file should be
Main-Class: packagename.mainclassname
and should correspond exactly to
/packagename/mainclassname.class
in your jar file (or jar file_s_ if you use Class-Path too).

OSGi NoClassDefFoundError when running outside of Eclipse with my Bundle

I have an application made up of multiple bundles. Inside eclipse it is working perfectly. When I export it as a product it was working perfect but something has changed and I can't work out what.
Now when I export my bundles, at runtime I get NoClassDefFoundError. The Error is in one of my bundle's activator and the class it is unable to find is in another bundle. A common bundle.
When I try to start the bundle I get the exception
Caused by: java.lang.NoClassDefFoundError: com/ardor/common/util/Systems
This class is in another one of my bundles com.ardor.common.
At the console when I inspect this bundle with the "bundle" command I get
Exported packages
com.ardor.common.util; version="0.0.0"[exported]
I'm stuck for ideas :(
When trying to remove compiler warnings I removed from the build.properties
output.. = bin/
with out this the bundle contains no class files
build.properties
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

How do you ensure a Utility Projects library dependency gets packaged in the final EAR in Eclipse Galileo?

I have a 'Utilty Project', and an 'EAR Project' that includes that 'Utility Project'. All the classes from the 'Utility Project' end up being packaged as a JAR and placed within the 'lib' directory of the exported EAR, for example:
EAR.ear
META-INF
MANIFEST.MF
lib
utility.jar (which expands to):
META-INF
MANIFEST.MF
com
acme
Foo.class
Bar.class
However, the 'Utility Project' relies on a library (freemarker.jar) that has been added to the build path using 'Properties > Java Build Path > Libraries'. All I want to do is to get freemarker.jar added to the EAR as follows:
EAR.ear
META-INF
MANIFEST.MF
lib
**freemarker.jar**
utility.jar (which expands to):
META-INF
MANIFEST.MF
com
acme
Foo.class
Bar.class
By searching around within Eclipse I've found 4 potential avenues for achieving this, none of which have worked. If someone can just cut to the chase and tell me what I should actually do, that would be great. But just in case, I'll iterate them here:
From the 'Utility Project' Properties:
If I click 'Java Build Path > Order and Export' and select 'freemarker.jar' for export, the jar does not end up in the EAR file at all.
If I click 'Java EE Module Dependencies' and select the 'freemarker.jar' library as a dependency, it says:
This JAR is a bundled library of an
EAR project and is supposed to be
packed in the EAR's library directory.
It conflicts with the manifest class
path dependency you are trying to
create. If you create this dependency,
the JAR will be packed in the root
(not library) directory of the EAR.
Are you sure you want to proceed?
From the 'EAR Project' Properties:
If I click 'Java EE Module Dependencies > Add JARs...' and navigate to the 'freemarker.jar', and make it a dependency, it gets added to the root of the EAR:
/freemarker.jar
If I do the same as above, but check the 'In Lib Dir' checkbox, it gets added into the lib folder, but contained within another lib folder:
/lib/lib/freemarker.jar
Thanks.
I've managed to solve this problem. In the Problems window I was getting the following warning:
Classpath entry /utility-project/lib/freemarker.jar will not be exported or published.
Runtime ClassNotFoundExceptions may result.
What I tried, at a whim, was to use the Ctrl-1 key combination I've been using to get quick fix solutions for my source code. It turns out this also provides quick-fix solutions for for the given errors and warnings. I chose the first of the two options:
Mark the associated raw classpath entry as a publish/export dependency.
and my problem disappeared!
Bizarrely, all this seems to have done is to cause the 'freemarker.jar' lib to be selected in the 'Java EE Module Dependencies' properties dialog, which I was doing myself anyway. This may be an Eclispe bug!
#MonoThreaded: After using the quick fix > Mark the associated raw classpath entry as published/export dependency, if you right-click on the project > properties > depolyment assembly you will notice that eclipse has added a new entry, something like source: /freemaker.jar, deploy path: ../lib. You can do that too, by selecting Add > Java Build Path Entry.