I have a bunch of .ini files that I wish to include with my NetBeans Platform framework Java application and I do not know how to do that. What I want is to include these files with the default NetBeans Platform framework installer. Also, how do I access these files using Java code?
Please note that my question is about the NetBeans Platform framework, not NetBeans IDE.
Add the files to the application Jar. Access them using the advice seen in the info. page on embedded resources (see tag above).
Related
I'm using Netbeans 12 with Ant to build my apps. The default folder for libraries is 'lib'. Is there any simple and straightforward way to change it? For example I need to put my libraries in the same folder together with my main .jar when building.
I've checked some older related questions here, but answers were either too complicated or not actual anymore (provided links not working etc.)
Using the NetBeans Project Wizard, select File > New Project > Java with Ant > Java Application, and click Next>.
The wizard screen will include a checkbox labeled Use Dedicated Folder for Storing Libraries. To change the default folder for libraries check that box, and then the following field labelled Libraries Folder will become enabled. You can replace the default value of .\lib with your own directory. For example:
You can use the same approach when creating web applications and enterprise applications. The field settings are sticky, so be sure to check that the values remain appropriate when creating subsequent projects.
I couldn't find any NetBeans 12 documentation on this, but the NetBeans 8.2 documentation remains valid. See section 6.6 Sharing a Library with Other Users for details:
You can configure most standard Java SE, Web, and Enterprise projects
in a way that makes it easy to share libraries with other users. You
can specify a location for libraries on which the project relies. You
can also specify how the libraries are referenced from your project...
Note that this approach will not put (what you called) main.jar in the specified libraries folder. That will still be placed directly under the dist directory. If you want to change that behavior I think you might need to modify some NetBeans Ant script(s).
I'm wondering how embedded databases work. Let's say I'm using derby databases on Netbeans for java IDE and everything works. If I zip up all the project files and send it to another user who's using IntelliJ as their IDE and they open the file can they run it straight off the bat (assuming JDK/java version etc are the same) or do they have to install things as well?
Everything can be embedded into a single package, such as a zip.
The typical deployment model is not to distribute your application as source code and project files, requiring your user to build the application in their IDE, but rather to distribute your application as bytecode class files, fully compiled, so your user can just copy the application package onto their system and run it directly.
When you do this, all they have to provide is a copy of the Java Runtime Environment.
Here's some docs on the subject: https://db.apache.org/derby/docs/10.15/devguide/cdevdeploy855368.html
The Derby documentation also contains a number of sample programs and tutorials, and I highly recommend doing the tutorials as they will help you understand the overall process: https://db.apache.org/derby/docs/10.15/getstart/cgstutorialintro.html
I inherited a Java app that is configured to run in Google App Engine. My pom includes the com.google.appengine.appengine-maven-plugin plugin, which may or may not be related to this question.
In my src directory, in the WEB-INF directory, I have a "app.yaml" file. But when my project is built into a war, the target directory has both a "app.yaml" file and a "appengine-web.xml" file. How did this "appengine-web.xml" file get here?
The first line of this "appengine-web.xml" file says <!-- Generated from app.yaml. Do not edit. -->. If this file was generated from an "app.yaml" file, then what generated it? Which plugin/function has created this file?
As mentioned in the official documentation appengine-web.xml Reference:
App Engine Java applications use a configuration file, named appengine-web.xml, to specify information about your app and to identify which files in the app's WAR file are static files (like images) and which are resource files used by the application.
So, this is created by default, by the App Engine environment, when using the App Engine Maven plugin, so you can handle some specific settings and configurations. You can find more details on these settings here, but it includes the setting of environment variables, how to scale the application - manual, basic or automatic - etc. In addition to that, you can check this example of a sample app that is deployed into war and the file is created as well. Please, bear in mind that this is only on Java 8.
To summarize, this file is created by the App Engine environment when using this plugin, not by a specific function. In this official documentation here, it indicates this as well:
The artifact you used to create the project has done the basic src/main/webapp/WEB-INF/appengine-web.xml configuration for you
So, this confirms that it was created via the plugin. Besides that, it shows the message of the relation with app.yaml, because they work together and each one of them has a specific use and settings that are needed for your application to work correctly.
Let me know if the information helped you!
This was a non-documented feature of App Engine Maven Plugin that was removed about two years ago.
https://github.com/GoogleCloudPlatform/app-maven-plugin/issues/426#issuecomment-665757462
I come from an Asp.Net development background and am very comfortable there. I was asked to support an existing Java Web Application w/ struts and am able to figure most of it out with my Asp.Net knowledge and my android development experience. However, I'm having a really simple but stupid problem.
All i have is the website as it exists on the server, no source project to work from. The folder on the server contains both .java and .class files, but the folder doesn't just import into netbeans as a recognized project.
What's the easiest way to get the site imported into some sort of IDE (I can work w/ eclipse too if netbeans isn't recommended), and get it to compile so I can deploy some updates.
It will not be easy to answer fully to your question here. But we should be able to achieve that by steps :)
Here i will speak for eclipse. But it is only because i'm not familiar with netbeans.
First of all create a clean "dynamic web project" under eclipse (using a J2EE enabled eclipse http://www.eclipse.org/downloads/).
Then :
copy your sources files in "Java Resources"
copy the rest of your application (without the class files) in WebContent
In order to test your application localy you will need a local server. Tomcat can be integrated easily in eclipse.
Usually you shouldn't have to (re)construct a project from a deployed web-app; the project should have been kept in version control. Source code isn't usually deployed to the server, either, but if it's been done in this case, you're in luck.
I would just make a new web project in NetBeans and manually move the .java files into it, along with the other resources (except for the .class files).
If you can use eclipse, and the source files are already in the war file as you say. You can import the war file directly into eclipse as project.
file -> import -> war file or existing project into workspce or filesystem (Several other options exists)
I've been developing a java application with the eclipse RCP which requires the Java Communications API. Now as the javax.comm has to be setup first (install javax.comm.properties, win32comm.dll and comm.jar) my question ist: How should I deploy my application to make sure javax.comm will be setup on the user's machine? Should I provide an installer which does the setup or should I let the application itself export the files in their respective directories?
I have never before done such a thing, so I'd appreciate any help.
Thanks
I'm using RXTX instead of Java Comm, but the problem is the same, i think. The RXTX site has a documentation about it, please see the Wiki. The description is for Eclipse 3.3, but works for 3.5 too.
How would you like to distribute your application? As a JAR, I assume? In this case you need to setup the JAR's manifest.mf file with a Class-Path entry which contains semicolonseparated relative paths to the desired resources (relative from the JAR file itself on). You can distribute your application with the javax.comm stuff included and if necessary write a readme.txt with installation instructions.