I have a netbeans project(web application) including database connections, i want to get the executable file for my project (because i do not want to share my source code), which can run without the source code?
I have tried using jar,but extracting jar we get all the source codes.
Related
I recently finished my first JavaFX project and am ready for deployment. I found that when I create the jar file for my project my ide creates a folder with the jar and other necessary files. I noticed that when I run the jar in the file everything works fine. However, when I take the jar our of that folder and place it as a desktop icon, various resources no longer become available - I am assuming this is because the jar file and the various resource files are no longer in the same file path/folder. - Is this the correct assumption to make?
Regardless, I wanted to ask what is the standard method of getting JavaFX resources and the accompanying jar file to work when the resources are not located in the same folder?
Essentially, I want to have a clickable desktop icon that launches the app, which the jar file fulfills. But if I put that jar file in a folder with its resources to get the project to work properly then the user will have to press the folder and then the jar file in order to get the project to launch - which is very counterintuitive.
Any ideas on how this issue is handled?
The best way to do this is to create a shortcut to your jar file not copy it to another location. The jar file depends on these resources to execute especially if you used external libraries.
The other alternative would be to export your jar file with the libraries included in the jar. This however would make your jar very huge depending on the number of libraries you have.
I hope this helps.
I build a simple qml app that I want to send to a customer (preferably as a .exe)
When i run build project the executable in the release directory is not doing anything.
With most languages ide's that was all I have to do, click a specific build button that would generate a executable and send it.
Do I need to take extra steps in qt to generate a release for customers?
Please read Qt documentation on how to deploy Qt programs on Windows: https://doc.qt.io/qt-5/windows-deployment.html
Most often you only need to call windeployqt to copy all the Qt related DLLs next to your exe file:
windeployqt --qmldir path_to/my/src/qml myprogram.exe
Then you can zip the folder and send it.
Note: If you are using MSVC, you will have a vc_redist.exe file. This is a setup to install the latest Visual C++ runtime, you need to make sure this setup is run before running your program. Usually this is done as part of the installation process of your program, when you distribute it as a "setup.exe".
If you want to send a single exe to a customer, you have 2 choices:
Make a setup. Meaning that the user will have to install the program.
Link Qt (and all libraries) statically. This means that you have to build your own static Qt library from source. It is not impossible but it is not simple. Also if you are using Qt under an open source license, that your program will be impacted more severely by the LGPLv3.
You can compress the folder into a self-extractible zip file. When the customer launch the program, it will extract all files (your main exe file + Qt dlls) into a tmp folder and then start your exe. This adds a significant start up time to your program because you have to unzip all files each time.
I am trying to populate a QTableview with some data. When developing under Qt Creator, data is read from build directory. Running the program each time, the QTableview keeps getting repopulated with previous data.
If I manually change the build directory each time before run, doesn't happen. But how do I solve the problem without manually changing the build directory every time I want a fresh run?
In your project directory there is a file name ProjectName.pro.user.
This file creating when you configure your project. it's XML file.
you can find this line on *.user files:
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/probook/Documents/Qt/testProject/Build/Windows/Debug</value>
This line define build directory address for debug. there is a same line for Release and Profile in that file.
You can also use Qt creator to define(customize) relative directory build:
goto Qt creator, Tools, Options..., Build & Run, General, Default build directory.
More info:
Qt Creator stores user-specific project settings in a .pro.user file. You can share these settings between several projects as a .pro.shared file. It has the same XML structure as a .pro.user file, but only contains the settings to share.
Based on comment, issue seems to be data which gets saved to build directory. And solution would be to remove it before running the application.
You can add Custom Process Step, either under Projects - Build Settings -
Build Steps, or under Projects - Run Settings - Deployment, and just delete the desired data files. Exact command depends on operating system.
An alternative might be to add a command line switch, something like --development-erase-saved-data, to the application itself, and erase the files (or just not read them, or whatever). Then add that command line switch to Projects - Run Settings - Run Steps - Command Line Arguments for desired build configurations.
Adding support for this in the application itself is easier to maintain, and is almost automatically cross-platform. However, it might be a feature you don't want in the application, though in that case you might only enable it for Debug builds (with #ifdef).
As a side note, saving data to executable directory is not a good idea these days. You might want to save it for example to location returned by
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
(See here for more info.)
I am new to power shell, I am trying to write a power shell script to build and publish the c#/.net application(Web). I have tried below code to generate build-
$projectFileAbsPath = .csproj path
$msbuild $projectFileAbsPath /t:rebuild /p:PlatformTarget=x86 /fl /p:outputpath=C:\test
by executing above line i am only getting dll of the project in destination folder. Supporting\Referenced dll's and related artifacts are missing.
Please help me understand where i am getting wrong and what additional things i need to do. Also, do i need any build configuration file .If yes, let me know if there is any sample posted on internet.
I'm using QWebView to run a web app. There are 650+ files. Placing the web app's directory in the source directory does not result in the executable bundling the directory.
How do I include the entire web app directory so that the executable will be able to render the files.
Note: I have currently added index.html as a resource, and can access it with qrc:// - But since I cannot add the entire directory structure to a qrc (can I?), the executable does not include the other files.
You need to put an XML node into the .qrc file for each file you want to use using the Qt resource system.
This can be done using a simple pre-build script. Take a look at qrcgen. Quoting the blog post behind this link:
The script I created, qrcgen, takes a directory and a prefix, recursively scans the directory and generates a .qrc file with the same name as the directory scanned. It has solved my problem, and I hope it can help others. It is also available via PyPI, just "easy_install qrcgen".
In order to update the .qrc file whenever your directory contens change, you need to include this step into your build process:
For C++/Qt projects, you can add this step in the build configuration in QtCreator or add in your qmake file a system(...) statement. Note that such commands aren't portable in general. (If it's not portable, you can put some operating system conditions around multiple commands.)
For PyQt/PySide projects, I don't know how to do this, but I'm sure you find a solution for this too.