deploy jar Java Desktop Application in jdeveloper12c - deployment

I have always developed my java NetBeans projects. When I finish my project, and automatically build "dist" folder where the main jar and a "lib" folder containing all the external jar was created. This is done automatically with the NetBeans IDE
Now I'm trying to do a project with jdeveloper 12c Java Desktop Application and try to deploy my project but I have problems with java.lang.NoClassDefFoundError. I meet several questions:
Can you add the same structure as I said before? That is, a file jar and inside a folder "lib" place the jars using How to do it?
I've seen examples that by New File Group adds refencias, but it really adds to the main jar file (as I see in the size of the file) but not saved in a separate folder.
I do not know if you can help me do this in jdeveloper 12c: Generate a jar file and folder lib with references.
Thank you for your help.

Go into the deployment profile for your project and add all the libraries and files that you need to be included to the JAR you are generating.

Related

JBoss 6.1.1.EAP Module Deployment: Class not found

The structure is as follows:
Actually deployed module is EAR.
EAR contains WAR module, and WAR module contains another JAR module.
In this last JAR, there are some generated classes and their parent folder is also used as source folder. Its path is "target/generated-sources/java".
The problem that is killing me, is that the deployed application throws ClassNotFoundException on server start, and the classes in question are the generated ones.
Now the trick:
if I explicitly change the Deployment Assembly in WAR project in Eclipse not to contain JAR project as "project", but as an archive from the JAR's project "target" folder, JBoss sees the generated classes and starts.
This solution however works only until next eclipse maven project update, so manual edit of deployment assembly is not really a solution.
Any ideas how to deploy or reorganise packages correctly?
OK, seems I have found the solution.
I looked through the build-path of the mentioned JAR file and saw that the entry Output folder pointed to target/test-classes.
After changing this entry to target/classes the application deploys and starts without any missing generated classes.
This is what worked for me:
Expand the 'target' folder of your maven project inside Eclipse (Project Explorer View);
Refresh it (F5);
Right click on your project on 'Servers' tab, then select "Full Publish";
Start your JBoss.
I had to enforce the JBoss Tool "Full Publish" to get an updated version of my target folder by Refreshing it manually on eclipse.
I don't know why but sometimes the Publishing from maven projects (even Full Publishes) do not copy classes from the target Project as it is in the file system. Maybe it's using some outdated memory info or some cache...
Anyway, this is what works for me.
After an update to Eclipse 4.15 and JBoss tools I got this problem too.
My solution: project -> properties -> Java Build Path --> Source
There my Output folder from my source was linked to project/target/classes, I changed this to project/target/project-projectversion/WEB-INF/classes
When I looked into the standalone JBoss folder I saw the folder structure of my source, but the classes where missing, when I changed the output folder the classes pop up and everything worked like before.
I am pretty sure the update made the problems.

Adding new jar in Netbeans project after building the project

I am developing a application in Netbeans7.1. I am facing one problem to add new jar file from the app after building the app.
As i know, when we build the project in Netbeans that will create a "jar" file and "lib" directory (which has all the libraries those are being used in the application) into the "dist" directory.
The problem is, I have to add new jar from my application into /lib/ directory after building the project. So that jar will be used in the application.
How should i do this?
If you have a successful build then it means the jar you wants to add is required at runtime not at compile time otherwise it wouldn't have compiled.
And if above is the case adding jar is straightforward.
Add the jar file to lib folder.
Now open you applications jar with some rar software like winrar.
Goto the META-INF folder open the MANIFEST.MF file and append the class path with lib/new_jar_file.jar.
Bingo..You are done.
Here is a screenshot of MAINIFEST.MF file and red box shows where to add the above mentioned lines.

Netbeans web application - excluding the JAR while building the WAR

I'm using Netbeans IDE for developing a web applications, and I've some JARs available in the application server which don't need to be in the WAR (but we need them to compile and run locally).
Is there an option in Netbeans to exclude the JAR file while building the WAR file?
Select the project in the Projects explorer window.
Pick the Project Properties item from the File menu (up in the menubar).
Select the word Libraries from the list on the lefthand side of the dialog that appears.
For each jar/library listed in the Compile-time Libraries list, uncheck those that do not need to be included in your war file.
I found the problem myself. I've all the libraries under my lib folder and added them to the project class path. Since the build is copying the entire content in the project, my library is also copying even though I've unchecked the package check box against the library.
So, don't put the library in your lib folder if you want to exclude that in the WAR built.
Thanks
Santhosh

how to setup the sphinx with netbeans

i have successfully configured sphinx4 with eclipse.
for that these steps i have used.
copy my java and config files to SRC folder
all the necessary jar files (in the lib). the lib folder added to the root of the project
build those jar files (jsapi files too)
change the configuration file and give the proper path
test the java file
but in Netbeans i really dont understand how to do the proper steps. can someone help me. the jar files should be added to "Libraries" rite.
then after adding them how to build them.
in the netbeans it dont show a SRC folder. so all the java files and configuration files should go to Source Packages folder rite.
can someone help me with this. please
If you have sphinx4-1.0beta6 then you can just open the folder up as a netbeans project. Open netbeans, click open project, then navigate to the sphinx folder and open it. It is already a netbeans project file type as of this version. I assume this will work in later versions also. I have no clue why sphinx doesn't say this on their website.
Sphinx4 is a Java library available in OSS repository, so you can use it as any library.
If your project uses maven/gradle, add repository in your project configuration, then add dependency on two packages - sphinx4 core and sphinx4-data. The former is the main library, the latter is required if you want to recognize US English. Then just start writing the code.
If you want to rely on jar files, just download sphinx4-core and sphinx4-data files from the repository and add them as dependency to the project, then start writing code.
If you want to modify or develop sphinx4 itself, install Gradle support in your IDE, then import latest sphinx4 sources as a Gradle project.
For more details and links see the tutorial
http://cmusphinx.sourceforge.net/wiki/tutorialsphinx4
click on Add JAR/Folder
select jar file you want to add

How do I deploy/import war package into Netbeans

I have looked through the help documentation in netbeans 6.5.1 but cannot find anything explicit explaining how to deploy/import a war package.
I know in Eclipse, it's as easy as right clicking in the Project Explorer >> select IMPORT >> WAR FILE.
However, I still am unable to find a solution for Netbeans.
Thankyou,
Jordan
posted elsewhere, thought i might post here too.
after some googling I've found the solution and here are the steps:
(tested using apache's ode.war in NetBeans 8.0)
unzip the war file
in the unzipped folder, you will see WEB-INF/, META-INF/, etc., create a sub-folder named web in the unzipped folder.
put everything else into web (now they will be web/WEB-INF/, web/js/, ...)
go to netbeans, new project -> java web -> web application with existing sources
pretty much just press next all the way through. voilĂ , it's done.
I assume you don't already have an ant or maven project for your web project? If you did, you would just import a maven project or create a Web Free-Form Application and wire it up to your ant script.
I would unzip the war file, create a new web application with existing sources in netbeans and wire everything up using the wizard.
Import the war project to eclipse.
Then import the eclipse project to netbeans
If you don't have eclipse handy, just place the war file into the webapps folder of Tomcat, go to the bin folder of Tomcat and run startup. Tomcat will automatically extract the war file for you. Now go to the webapps folder and you'll find another folder there, with the same name as your war.
I couldn't find an option to import a war directly into Netbeans (strange. Perhaps someone could create this feature and submit it as a patch to Netbeans). The folder which gets extracted into the Tomcat folder can be used as the Netbeans project. It's advisable to copy it to some other folder first. Import by File > New Project > Web application with existing sources.
Eclipse has an option to export a war and include the sources with it too, so there's a chance that the source files are in the war too.