I have installed Red5 server successfully and also am able to run the demos fine. Now, I want to create a sample red5 server application. I created a sample project according to the specific directory structure that Red5 requires. But, now when I try to open this project in Netbeans 6.8, I am unable to because both have a different directory structure. So, Netbeans doesn't consider it as a project. I actually want to convert this project to a war file, so I can deploy it to red5/webapps directory and then red5 deployer service can make project out it automatically. How do I convert this project to a war file? because in Netbeans I am unable to open it. Please help.
I don't know if this will fully answer your questions but this is my configuration.
In the main red5 directory there is a file called project.zip, you can open it to get basic configuration files, directories structure and build files for ant (Pure Java build tool).
Using netbeans, you create a new free-form project and point it to the directory of your project. because of the ant build files the project will be recognized.
Netbeans provides it's own ant version but i prefer to install and use ant from command line.
when you'll run ant in the project directory it will try to find dependencies and probably at first will complain that it cannot find ivy.
Ivy is a dependency manager that red5 project uses that can be found in the following URL: http://ant.apache.org/ivy/download.html
please notice that ant will tell you exactly where it searches for the required jar file, just download the ivy zip, unzip it, and place the jar inside it in the requested directory.
once ant will compile the project properly (just by running the commant ant), it will also create a war file under dist directory.
don't forget to add to your red5 netbeans project the relevant red5 jars in order for the project to compile properly.
I am also prefer use ant from command line. I have two directory structures. One for source files and another for deployment.
This example helped me to start.
Related
I'm trying to utilize a resource directory in a maven project on Netbeans 11. I can't properly access the files in the resources directory when I build my code using Netbeans—however, it works fine when I build and run the code using mvn via the command prompt.
More specifically, I'm trying to load an image, bern.png, that I have stored in a directory located at /src/main/resources. When I use the following code to try and access those resources, however, I run into a NullPointerException when toString() is called on the result of getResource():
String path = this.getClass().getClassLoader().getResource("bern.png").toString();
Here is the NullPointerException stacktrace:
https://pastebin.com/KqJVxWEL
However, when I build and run the project using mvn via the command line, the project builds without issue.
Thus, the problem must lie with the way that Netbeans is viewing the resources folder that I've created.
Here is an image of my project file tree:
And here is an image of my target build file tree:
I created the resources directory by creating a New > Folder in main. As you can see, bern.png in the resources directory does not populate in the target build.
After building and running the project using mvn via the command line, however, bern.png does populate:
I've found a few articles about this, but none of them have helped. This article from javaquery refers to Netbeans 8.0, and its instructions are no longer usable as written in Netbeans 11. This StackOverflow answer refers to Netbeans 7.2, and simply creating the directory as they suggested did not function for me in Netbeans 11. This StackOverflow answer was written for Netbeans 8.0 and also did not work.
With all of that said, does anyone know how to properly create a resources directory using NetBeans 11?
The issue wasn't that Netbeans was viewing the directory incorrectly—the problem was that Netbeans 11's default Maven build wasn't recognizing the directory correctly. Switching Netbeans's Maven system to the most recent binary from the Maven website addressed the issue.
I had the same problem using a Maven project under Netbeans 11.3 for the Netty client/server framework example http2/tiles. Because using the source files from netty-all-4.1.50.Final-sources.jar, the jpg resource files were located inside the directory io/netty/example/http2/tiles together with the java files. Copying this directory to the Netbeans Maven project's subdirectory src/main/java will result in the problem, that these resource files are not included in the target jar file.
The solution is to locate the resource files in a subdirectory main/resources as it is done in the Netty Github repository https://github.com/netty/netty/tree/4.1/example/src/main. Resource files in this location are automatically added to the target jat file when the project is build.
For my development project I am having to use Java jars and Shell script along with config files.
In eclipse currently I am just developing the Java jar applicaiton and then exporting it into a seperate folder where my Shell script is and other files.
Then I FTP this folder into server directory.
However I am running into problems where my shell script or java version are not the same.
Is there any way for me to just package it all into one eclipse project and export it as the following
My Project
shell script.sh
myappplication,jar
myconfig.cfg
archive folder
I tried putting it all in my SRC folder but all that I get out is a jar file from exporting the project.
Any suggestions welcome
I would recommend using either Ant or Maven, both of which are well-integrated into Eclipse (Maven is integrated by default in the latest release).
Depending on your project, it's possible Maven (which is a build lifecycle management system) is overkill, but check it out and see how it might aid your build process.
Using Ant would allow you to create a process which would gather your files together and transfer them to your remote system.
You can also check out ShellEd for building shell scripts in Eclipse. I've found it somewhat hit-or-miss, but it does allow me to stay in one IDE for most of my work.
I have a plain Java project (not a plugin project) which I want to add to a classpath of a eclipse plugin which I am developing. But in web projects I can add that project as a build path and it works fine. But I tried same thing in eclipse plugin, I am able to compile successfully, but at run time I am getting java.lang.ClassNotFoundException.
I know OSGi quite well and I know how to add OSGi into an classpath (using export-packages) but what I want is to add Standard, non-osgi project into an classpath, so that I wont' get runtime errors. Is there anyway I can achieve this?
I can export project as a jar file or make it as a plugin project and it would work fine. But that's not my option currently because, still that API is in pre-alpha stage, and there would be lot of changes going on. So I am trying to avoid pain of exporting it as jar file everytime. Is there any option for me other than this?
I have a similar situation: I want non-OSGi Maven dependencies integrated into the classpath of my plugin. I succeeded with a roundabout solution, which I think is the best I could get.
I have a build step outside of Eclipse where I copy the class files of the dependency into the plugin's lib folder. The lib folder is specified in MANIFEST.MF as an entry in Bundle-ClassPath and (here comes the hack) as a source folder in build.properties. That was the only way to make the plugin work both when launched from within Eclipse and when exported.
I have created a java project using eclipse and in that project I have included a few jar files such as sqljdbc4.jar, jtds-1.2.4.jar, and log4j-1.2.17.jar. I have also included a dll for windows authentication in this project. I'm attempting to export this project as either a .zip .tar etc so the project can later be imported by someone else and work with the project.
I want to export the file in a way that the other developer can import the project and instantly begin working without having to download the jar files that the project is dependent on. Is this possible at all
I have already tried what i have thought would have worked going to export -> Archive file -> save in .zip format. I was unsuccessful with this I also figured going to properties -> Order and Export tab and selecting the needed jars would work and then exporting still unsuccessful.
Once the other developer imports the project the jars are not there for him...
I would use Ant. It is integrated right into eclipse and takes an .xml file called build.xml. It works by specifying "targets" in the xml file that each perform some action such as "build" (i.e. run javac), "deploy" (i.e. run the jar command), etc. There is a command that can be called from within the jar target called zipgroupfileset which you can use to package all of the jars within your main jar file.
More info about ant can be found here
There are many variations on the following but the basic idea is to
use a code library and share the project. The repository
can be local to you or even better put it on an http server
( ala VisualSVN or google or the like ).
1st (local) solution:
Install SVN ( http://subversion.apache.org/ )
Install SubVersion
Create a repo on your local file system
Share the project
Dump the repo
Send the repo
Load the repo (Other developer)
2nd (network) solution (using google code as your library)
Install SVN ( http://subversion.apache.org/ )
Install SubVersion
Put your project on GoogleCode (http://code.google.com/)
Other developer gets project
I have an eclipse Tomcat project that has several dependencies on other eclipse projects.
For example imagine the main project is called server and has several dependencies:
server
(depends on):
data-lib
server-utils
messaging-utils
Currently every time I change data-lib,server-utils,messaging-utils I have to recreate the .jar file and copy it into WEB-INF/lib directory of server. At that point I export the server as a .war and deploy to my server.
I want to make this process work from the cmd line using ant (note I know maven is out there but I know ant pretty well from past experience so would prefer sticking to it for now). Its easy enough to create the build file for server -- it will end up creating a .war file. But I want it to automatically build the dependent libs. I want to do this while preserving my development workspace in Eclipse.
What is the easiest and cleanest way to do this? Currently my thought is each individual project will have its own build.xml (i.e. data-lib/build.xml , server-utils/build.xml , etc). I will have the server/build.xml do an antcall to these individual build files and then copy the jars to the server/WEB-INF/lib directory.
Is there an easier/better way?
if you want an Ant based script, I would go with Apache Ivy. The basic idea is that each of your submodule has its own build.xml file and publishes (via Ivy) their "publications" (like a Jar file) to a repository on the file system. The other modules then import these "publications" to build the final product.
I am not sure if it can help you, but in your WAR project, right-click on it in Package Explorer, and click on Properties.
There is a "J2EE Module Dependencies". In this option, select all of the dependencies (i.e. "data-lib", "server-utils" and "messaging-utils").
Now, when you modify a Java class in one of the dependencies, Eclipse will recreate the JAR file and deploy it directly in the WEB-INF/lib of your web application.